Use similar code to Tempfile.create instead of Tempfile.open
Merge pull request #149 from sstephenson/fast-tmpfile

Optimize: Tempfile management