code: func (s *session) close() error {
  	s.closeOnce.Do(func() {
  		s.cancel()
  		if s.conn != nil {
  			s.conn.Close(false)
  		}
  		close(s.closed)
  	})
  
  	return nil
  }
docs: // close the given session. It should be called only in <-session.errs branch
  // of event loop, or when cleaning up the agent.