Win32: fix potential multi-threading issue