diff --git a/MultiServer.py b/MultiServer.py index bac35648cf5a..764b56362ecc 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -1960,8 +1960,10 @@ def _cmd_status(self, tag: str = "") -> bool: def _cmd_exit(self) -> bool: """Shutdown the server""" - self.ctx.server.ws_server.close() - self.ctx.exit_event.set() + try: + self.ctx.server.ws_server.close() + finally: + self.ctx.exit_event.set() return True @mark_raw