RTGOV-298 Fix exception when shutting down server