code: def closeEvent(self, e):
          
          if self._closed:
              return
          res = self.emit('close')
          # Discard the close event if False is returned by one of the callback
          # functions.
          if False in res:  # pragma: no cover
              e.ignore()
              return
          super(GUI, self).closeEvent(e)
          self._closed = True
docs: Qt slot when the window is closed.