// Close closes the alias store.
1716
func (a *Aliases) Close() error {
	a.mtx.Lock()
	defer a.mtx.Unlock()

	return a.db.Close()
}
1344245
func (s *memcacheStore) Close() {
	// Flush out sessions that were accessed from this store. No need locking, we're closing...
	// We could use Codec.SetMulti(), but sessions will contain at most 1 session like all the times.
	for _, sess := range s.sessions {
		s.setMemcacheSession(sess)
	}

	if s.onlyMemcache {
		return // Don't save to Datastore
	}

	if s.asyncDatastoreSave {
		go s.saveToDatastore()
	} else {
		s.saveToDatastore()
	}
}
247882
func (conn *UnixConn) Close() error {
	close(conn.closeChan)
	return conn.unixConn.Close()
}
1140641
func (ss *SQLSubStore) Close() error {
	ss.Lock()
	if ss.closed {
		ss.Unlock()
		return nil
	}
	// Flush before switching the state to closed.
	err := ss.flush()
	ss.closed = true
	ss.Unlock()
	return err
}
835077
func (f *DatastoreFile) Close() error {
	var err error

	if f.body != nil {
		err = f.body.Close()
		f.body = nil
	}

	f.buf = nil

	return err
}
359894
func (provider *Provider) Close() {
	provider.idStore.close()
	provider.ledgerStoreProvider.Close()
	provider.vdbProvider.Close()
	provider.historydbProvider.Close()
	provider.bookkeepingProvider.Close()
	provider.configHistoryMgr.Close()
}
1240535
func (c *NamenodeConnection) Close() error {
	if c.conn != nil {
		return c.conn.Close()
	}
	return nil
}
1189688
func (t *mwc) Close() error {
	for _, wc := range t.wcs {
		err := wc.Close()
		if err != nil {
			return err
		}
	}
	return nil
}
864068
func (s *Store) Close() (lastIdx uint64, err error) {
	// Notify goroutines of closing and wait until they finish.
	close(s.closing)
	s.wg.Wait()
	s.mu.Lock()
	defer s.mu.Unlock()

	for _, l := range s.subscribers {
		for el := l.Front(); el != nil; el = el.Next() {
			go el.Value.(*subscription).Close()
		}
	}
	if s.raft != nil {
		s.raft.Shutdown().Error()
		lastIdx = s.raft.LastIndex()
		s.raft = nil
	}
	if s.transport != nil {
		s.transport.Close()
		s.transport = nil
	}
	if s.stableStore != nil {
		s.stableStore.Close()
		s.stableStore = nil
	}

	return lastIdx, nil
}
1307756
func (p *PenName) Close() error {
	if p.returnError != nil {
		return p.returnError
	}

	p.Closed = true
	return nil
}
1109612
func (i *macIdentity) Close() {
	if i.ref != nilSecIdentityRef {
		C.CFRelease(C.CFTypeRef(i.ref))
		i.ref = nilSecIdentityRef
	}

	if i.kref != nilSecKeyRef {
		C.CFRelease(C.CFTypeRef(i.kref))
		i.kref = nilSecKeyRef
	}

	if i.cref != nilSecCertificateRef {
		C.CFRelease(C.CFTypeRef(i.cref))
		i.cref = nilSecCertificateRef
	}
}
1221337
func (c *Cache) Close() {
	if !atomic.CompareAndSwapInt32(&c.closed, 0, 1) {
		// Already closed
		return
	}
	logger.Debugf("%s - Closing cache", c.name)
	c.DeleteAll()
}
1087827
func (s *Server) Close(ctx context.Context) error {
	return s.Shutdown(ctx)
}
438619
func (r *Reference) Close() {
	if !r.setClosed() {
		// Already closed
		return
	}

	logger.Debug("Closing reference")

	r.notifyClosing()
	r.wg.Wait()
	r.finalize()
}
359873
func (s *session) close() error {
	s.closeOnce.Do(func() {
		s.cancel()
		if s.conn != nil {
			s.conn.Close(false)
		}
		close(s.closed)
	})

	return nil
}
856227
func (s *attrStore) Close() error {
	if s.db != nil {
		s.db.Close()
	}
	return nil
}
597441
func (ms *SQLMsgStore) Close() error {
	ms.Lock()
	if ms.closed {
		ms.Unlock()
		return nil
	}
	// Flush before switching the state to closed
	err := ms.flush()
	ms.closed = true
	if ms.expireTimer != nil {
		if ms.expireTimer.Stop() {
			ms.wg.Done()
		}
	}
	ms.Unlock()

	ms.wg.Wait()
	return err
}