Fix race condition in ThreadPoolExecutor when worker threads are created during interpreter shutdown.