closing tempfile fix