tmp file would be removed, I fixed this by Dir.tmpdir which returns tmp dir path on current system