Ensure the window.close event is always sent along with the KPI event stream it belongs to.

@kparlante, @6a68 and @seanmonstar - I could use some review here! Scary update to WinChan, I have yet to put a PR against that repo. Do you think this can be done another way using the existing callbacks, or does a new callback make more sense?

We incorrectly made the assumption that if a message was received by WinChan from the dialog, that all dialog processing was complete. This had the effect that if an assertion was generated in the dialog, a message with the assertion was sent to WinChan, _include.js took this as meaning all processing was complete in the dialog, and told the communication_iframe to submit the KPIs. The KPI event stream was cleared, and then the dialog would close, causing window.unload to be added to the recently cleared event stream.

To fix this, I added a new optional callback, close_cb, as input to WinChan.open. This callback is triggered due to a new 'close' message that is postMessage'd from the dialog's unload event handler. close_cb is then hooked up to send a message to the communication_iframe that the dialog is closed and that is *now* safe to send the KPIs.

In addition, IE8 was unable to write the window.unload event to the event stream from the window.unload event handler. Instead, writing this final event must be done in window.beforeunload.

fixes #3794