code: func (ref *Consumer) Close() error {
  	ref.Debug("entering consumer close ...")
  	defer func() {
  		ref.Debug("running defer ...")
  		if ref.closed {
  			ref.Debug("consumer already closed ...")
  			ref.Unlock()
  			return
  		}
  		ref.Debug("setting closed ...")
  		ref.closed = true
  		ref.Debug("closing closeChannel channel ...")
  		close(ref.closeChannel)
  
  		if ref.xwg != nil {
  			ref.xwg.Done()
  		}
  		ref.Unlock()
  	}()
  
  	ref.Debug("about to lock ...")
  	ref.Lock()
  	ref.Debug("locked ...")
  	if ref.closed {
  		return nil
  	}
  
  	// close consumer
  	ref.Debug("calling consumer close ....")
  	err := ref.Consumer.Close()
  	if err != nil {
  		ref.Errorf("consumer close error: %v", err)
  		return err
  	}
  	ref.Debug("consumer closed")
  
  	return nil
  }
docs: // Close closes the client and consumer