code: func (db *Database) Close() error {
  	db.quitLock.Lock()
  	defer db.quitLock.Unlock()
  
  	if db.quitChan != nil {
  		errc := make(chan error)
  		db.quitChan <- errc
  		if err := <-errc; err != nil {
  			db.log.Error("Metrics collection failed", "err", err)
  		}
  		db.quitChan = nil
  	}
  	return db.db.Close()
  }
docs: // Close stops the metrics collection, flushes any pending data to disk and closes
  // all io accesses to the underlying key-value store.