close temp file

The test can't remove the temp file on Windows, because `mkstemp()` will open the temp.
Merge pull request #333 from SteelyWing/patch-3

close temp file