output errors to csv file