Safer disk operations. Delete temp files on errors.