Method to check if a file exists