Added error protection for CSV file opening.