Improve the event handling at server shutdown
The event handling caused unhandled exception when shutting down the server when a real core was connected.
These changes together with TODO should fix these issues.
Aufgrund einer Wartung am 30.07.2024 von 8:00 bis 09:00 Uhr werden git.rwth-aachen.de & git-ce.rwth-aachen.de zeitweise nicht zur Verfügung stehen. -- Due to maintenance at 30.07.2024 from 8:00 to 09:00, git.rwth-aachen.de & git-ce.rwth-aachen.de will be temporarily unavailable.
The event handling caused unhandled exception when shutting down the server when a real core was connected.
These changes together with TODO should fix these issues.