apply closure-terminate-fixes-r2519 by @josephg

Patch source:
https://raw2.github.com/josephg/node-browserchannel/9cb33279ead539e5380470128a892e082ed34799/closure-terminate-fixes-r2519.patch