code: func (w *wallet) Close() error {
  	// Ensure the wallet was opened
  	w.stateLock.RLock()
  	hQuit, dQuit := w.healthQuit, w.deriveQuit
  	w.stateLock.RUnlock()
  
  	// Terminate the health checks
  	var herr error
  	if hQuit != nil {
  		errc := make(chan error)
  		hQuit <- errc
  		herr = <-errc // Save for later, we *must* close the USB
  	}
  	// Terminate the self-derivations
  	var derr error
  	if dQuit != nil {
  		errc := make(chan error)
  		dQuit <- errc
  		derr = <-errc // Save for later, we *must* close the USB
  	}
  	// Terminate the device connection
  	w.stateLock.Lock()
  	defer w.stateLock.Unlock()
  
  	w.healthQuit = nil
  	w.deriveQuit = nil
  	w.deriveReq = nil
  
  	if err := w.close(); err != nil {
  		return err
  	}
  	if herr != nil {
  		return herr
  	}
  	return derr
  }
docs: // Close implements accounts.Wallet, closing the USB connection to the device.