Write as csv file