Fixed an exception being thrown when the server is shutdown.