Ensure a trailing comma is not inserted into the CSV file