diff --git a/node_modules/browserstack-runner/lib/local.js b/node_modules/browserstack-runner/lib/local.js
index 15b147c..1bfb0f2 100644
--- a/node_modules/browserstack-runner/lib/local.js
+++ b/node_modules/browserstack-runner/lib/local.js
@@ -185,7 +185,7 @@ var Tunnel = function Tunnel(key, port, uniqueIdentifier, config, callback) {
     function(response) {
       response.pipe(file);
 
-      response.on('end', function() {
+      response.on('close', function() {
         fs.chmodSync(localBinary, 0700);
         setTimeout(function() {
           tunnelLauncher();
