code: func (conn *Connection) Close() {
  	subs := []string{}
  
  	conn.subMu.Lock()
  
  	for s := range conn.chanSubscriptions {
  		subs = append(subs, s)
  	}
  
  	for s := range conn.subscriptions {
  		subs = append(subs, s)
  	}
  
  	conn.subMu.Unlock()
  
  	for _, s := range subs {
  		err := conn.Unsubscribe(s)
  		if err != nil {
  			conn.logger.Warnf("Could not unsubscribe from %s: %s", s, err)
  		}
  	}
  
  
  	conn.Flush()
  
  	conn.conMu.Lock()
  	defer conn.conMu.Unlock()
  
  	conn.logger.Debug("Closing NATS connection")
  	conn.nats.Close()
  }
docs: // Close closes the NATS connection after flushing what needed to be sent