diff --git a/lib/index.js b/lib/index.js
index <HASH>..<HASH> 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -95,7 +95,9 @@ function onPart (part) {
   function onEnd () {
     part.removeListener('data', onData);
     part.removeListener('end', onEnd);
-    ws.once('close', done);
+    ws.once('close', function (_) {
+      done();
+    });
     ws.end();
   };
fixed; writeStream!close arg handling