docs: def prepare_destruction(self):
          """Saves current configuration of windows and panes to the runtime config file, before RAFCON is closed."""
          plugins.run_hook("pre_destruction")
  
          logger.debug("Saving runtime config to {0}".format(global_runtime_config.config_file_path))
  
          # store pane last positions
          for key, widget_name in constants.PANE_ID.items():
              global_runtime_config.store_widget_properties(self.view[widget_name], key.replace('_POS', ''))
  
          # store hidden or undocked widget flags correctly -> make them independent for restoring
          for window_key in constants.UNDOCKABLE_WINDOW_KEYS:
              hidden = False
              if not global_runtime_config.get_config_value(window_key + "_WINDOW_UNDOCKED"):
                  hidden = getattr(self, window_key.lower() + '_hidden')
              global_runtime_config.set_config_value(window_key + '_HIDDEN', hidden)
  
          global_runtime_config.save_configuration()
          
          # state-editor will relieve it's model => it won't observe the state machine manager any more
          self.get_controller('states_editor_ctrl').prepare_destruction()  # avoid new state editor TODO tbd (deleted)
          rafcon.core.singleton.state_machine_manager.delete_all_state_machines()
          rafcon.core.singleton.library_manager.prepare_destruction()
  
          # gtkmvc installs a global glade custom handler that holds a reference to the last created View class,
          # preventing it from being destructed. By installing a dummy callback handler, after all views have been
          # created, the old handler is being removed and with it the reference, allowing all Views to be destructed.
  
          # Gtk TODO: check if necessary and search for replacement
          # try:
          #     from gtk import glade
          #     def dummy(*args, **kwargs):
          #         pass
          #     glade.set_custom_handler(dummy)
          # except ImportError:
          #     pass
  
          # Recursively destroys the main window
          self.destroy()
          from rafcon.gui.clipboard import global_clipboard
          global_clipboard.destroy()
          gui_singletons.main_window_controller = None