fix tempfile usage in tests to actually get the temp filename, instead of writing to "GLOB(...)" in CWD
on windows files open by a process have mandatory locks, so they cannot be deleted before the handles are closed