Wait for worker threads to actually shut down before stopping the main event loop.