Help: Don't use tmpfile() on windows

On windows, tmpfile() places the file in the root directory, which is protected on recent versions of Windows.

Use _tempnam to place the temporary file in TMP instead.

On other OS, continue to use tmpfile().