Better temporary file generation on Windows
Copying an invalid file should not create an empty dest file
Fix logic for removeDirectory return code on Windows
Extra assertion in test