Completed write to csv file