Shutdown the threadPool before awaiting termination.