csvwriter - added checks to ensure begin/end_row() is used correctly