It looks like you're using the async library.
The iterator you passed to async.each
requires that you call the callback regardless of whether there's an error or not. If you don't call the callback, async will assume that the operation is still running and will wait forever.
When you encounter an error, you should call the callback and pass the error as the first parameter.
So here's an example of what I mean. I've added callback(e);
to your error event handler.
}).on('error', function(e) {
console.error(arr[0] + ':' + arr[1]);
callback(e);
}).on('end', function(e) {