Shutting down thread pool if main application window is closed