Close temp file before deleting it.