code: def closeEvent(self, event: QCloseEvent):
          
          event.ignore()
          # Be safe and emit this signal, because it might be connected to multiple slots.
          self.action_close_window.triggered.emit(True)
docs: This function is automatically called when the window is closed using the close [X] button in the window
          decorations or by right clicking in the system window list and using the close action, or similar ways to close
          the window.
          Just ignore this event and simulate that the user used the action_close_window instead.
  
          To quote the Qt5 QCloseEvent documentation: If you do not want your widget to be hidden, or want some special
          handling, you should reimplement the event handler and ignore() the event.