tmpfile closing added