more safely remove tempfile