code: def closing(self, cancelable=False):
          
          if self.already_closed or self.is_starting_up:
              return True
          if cancelable and CONF.get('main', 'prompt_on_exit'):
              reply = QMessageBox.critical(self, 'Spyder',
                                           'Do you really want to exit?',
                                           QMessageBox.Yes, QMessageBox.No)
              if reply == QMessageBox.No:
                  return False
          prefix = 'window' + '/'
          self.save_current_window_settings(prefix)
          if CONF.get('main', 'single_instance') and self.open_files_server:
              self.open_files_server.close()
          for plugin in (self.widgetlist + self.thirdparty_plugins):
              plugin.close_window()
              if not plugin.closing_plugin(cancelable):
                  return False
          self.dialog_manager.close_all()
          if self.toolbars_visible:
              self.save_visible_toolbars()
          self.lspmanager.shutdown()
          self.already_closed = True
          return True
docs: Exit tasks