check file exists before trying to delete it