Fix Win/*NIX discrepancy in the `tempname` test

Fixes a test failure due to a discrepancy discussed in #9053.