Write CSV file