Update build scripts on Windows to improve reliability