Fix temp file extension, and unlink file when done