Replaced '/tmp' folder with tempfile.gettempdir() to let Python find
which is the temporary folder depending on the OS, and added the
platform.system() function to apply 'NUL' in Windows instead of
the Linux equivalent '/dev/null'.
It is necessary to add the '.exe' file extension to program filenames
when looking for them in Windows
There were errors caused by trying to create an already existing
directory, so check if it exists first
Closed open filehandles that caused errors by blocking file
deletion by shutil.rmtree in Windows
Tried to make 'test_build_not_writable' work under Windows
using several approaches but nothing worked. Folder permissions
are not affecting files inside, so skipping the test in Windows.
Added another instance of filehandle closing that was needed
for shutil.rmtree file deletion