In emulator mode, closing emulator first causes an error when closing main window. The method `self.dispatcherModel.die()` called by `closeEvent()` should check if the emulator is already closed.