Fix race condition in async require