code: func (s *session) Close() error {
  	serverSessions.Dec()
  	s.closeOnce.Do(func() {
  		// closing needs to happen asynchronously because the last client
  		// (session writer) will try to close this session, causing a deadlock
  		// because of closeOnce
  		go func() {
  			s.log.Infof("Closing session %v", s.id)
  			if s.term != nil {
  				s.term.Close()
  			}
  			close(s.closeC)
  
  			// close all writers in our multi-writer
  			s.writer.Lock()
  			defer s.writer.Unlock()
  			for writerName, writer := range s.writer.writers {
  				s.log.Infof("Closing session writer: %v", writerName)
  				closer, ok := io.Writer(writer).(io.WriteCloser)
  				if ok {
  					closer.Close()
  				}
  			}
  		}()
  	})
  	return nil
  }
docs: // Close ends the active session forcing all clients to disconnect and freeing all resources