From 6483b20dddd4c7d1e72985f66e34e7a655876827 Mon Sep 17 00:00:00 2001
From: Philip Damra <philip.damra@gstv.com>
Date: Sun, 29 Jul 2018 11:13:03 -0700
Subject: [PATCH] CsvWriterMix 'end' handler issue

This relates to https://github.com/agmen-hu/node-datapumps/issues/46

It looks like the 'end' handler calls write(null) on the stream in the 'end' handler. That throws an uncaught error
---
 src/mixin/CsvWriterMixin.coffee | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mixin/CsvWriterMixin.coffee b/src/mixin/CsvWriterMixin.coffee
index 6f3da8a..780f07c 100644
--- a/src/mixin/CsvWriterMixin.coffee
+++ b/src/mixin/CsvWriterMixin.coffee
@@ -64,6 +64,6 @@ CsvWriterMixin = (options) ->
 
     # Finishes writing the csv when the pump finishes.
     target.on 'end', ->
-      target._csv.writer.write(null)
+      target._csv.writer.end()
 
 module.exports = CsvWriterMixin