delete file on error