Close temporary file before moving it.