fix csv file writer flags(use wb insead of w)