Quit server on close is now implemented in a cleaner and easier understandable way. It also doesn't impact the application shutdown time any more.