modify method deleteFile considering if the file exists