flush and close the csv writer
Merge pull request #11 from metridoc/flush-and-close-csvwriter

flush and close the csv writer