Fixed race condition on windows