Add closure detection WiP

Despite having created a much smaller test I'm still seeing this error on the tests:

![1__bash](https://cloud.githubusercontent.com/assets/1514/5494713/fbaccec8-86ee-11e4-8203-77256aeac320.png)

Running the test on its own passes.

@kumar303 any thoughts on what might be causing it?
Yeah - I think I agree (from our discussions yesterday) that the more direct postMessage on unload approach is better. I don't see much point in landing this to remove it later - it's not super critical.