code: func (e *Engine) Close() error {
  	e.mu.RLock()
  	if e.closing == nil {
  		return nil // Already closed
  	}
  
  	close(e.closing)
  	e.mu.RUnlock()
  
  	// Wait for any other goroutines to finish.
  	e.wg.Wait()
  
  	e.mu.Lock()
  	defer e.mu.Unlock()
  	e.closing = nil
  
  	if err := e.sfile.Close(); err != nil {
  		return err
  	}
  
  	if err := e.index.Close(); err != nil {
  		return err
  	}
  
  	return e.engine.Close()
  }
docs: // Close closes the store and all underlying resources. It returns an error if
  // any of the underlying systems fail to close.