code: def disconnect(self, close=True):
          
          if not self._connected:
              # already disconnected so let's return
              return
  
          if close:
              for open in list(self.open_table.values()):
                  open.close(False)
  
              for tree in list(self.tree_connect_table.values()):
                  tree.disconnect()
  
          log.info("Session: %s - Logging off of SMB Session" % self.username)
          logoff = SMB2Logoff()
          log.info("Session: %s - Sending Logoff message" % self.username)
          log.debug(str(logoff))
          request = self.connection.send(logoff, sid=self.session_id)
  
          log.info("Session: %s - Receiving Logoff response" % self.username)
          res = self.connection.receive(request)
          res_logoff = SMB2Logoff()
          res_logoff.unpack(res['data'].get_value())
          log.debug(str(res_logoff))
          self._connected = False
          del self.connection.session_table[self.session_id]
docs: Logs off the session
  
          :param close: Will close all tree connects in a session