error handling for removing file