Check if file exists before reading it.