code: func (s *Session) OnClose(c func()) error {
  	if !s.IsFrontend {
  		return constants.ErrOnCloseBackend
  	}
  	s.OnCloseCallbacks = append(s.OnCloseCallbacks, c)
  	return nil
  }
docs: // OnClose adds the function it receives to the callbacks that will be called
  // when the session is closed