rewind tempfile after writing