Tempfile reopen added to make mved OSX-compatible