code: func (s *UtxoScanner) Stop() error {
  	if !atomic.CompareAndSwapUint32(&s.stopped, 0, 1) {
  		return nil
  	}
  
  	close(s.quit)
  
  batchShutdown:
  	for {
  		select {
  		case <-s.shutdown:
  			break batchShutdown
  		case <-time.After(50 * time.Millisecond):
  			s.cv.Signal()
  		}
  	}
  
  	// Cancel all pending get utxo requests that were not pulled into the
  	// batchManager's main goroutine.
  	for !s.pq.IsEmpty() {
  		pendingReq := heap.Pop(&s.pq).(*GetUtxoRequest)
  		pendingReq.deliver(nil, ErrShuttingDown)
  	}
  
  	return nil
  }
docs: // Stop any in-progress scan.