Put file deletes in try statements.
Remove print statment which sometimes causes exception.