fix a bug where templary file might be removed using Tempfile

https://twitter.com/naoya_ito/status/373345195598680064