improved temporary file deletion policy