Really simple to simulate. Create this html file, load on IE8 with debugging activated, and hit F5 to reload. I guess in firefox the error occurs too but it bypasses the error notification as it is on unload event.
First the unloadListeners is clean, and then Ext.EventManager._unload(); is fired. Somewhere on Ext.EventManager._unload(); method chain it calls removeListener(), to remove the unload event attached by us at the body element. That's when unloadListeners is null and the error occours
clear unloadListeners after call Ext.EventManager._unload();