Fixes the bug in [ENG-2450](https://linear.app/comm/issue/ENG-2450). If you closed a window and opened a new one, double-clicking on the top bar caused an error.
The issue was that after closing the window (but not the whole app), the callbacks weren't cleared and had references to the (now closed) window.
This diff:
- unregisters 'clear-history' and 'double-click-top-bar' after the window is closed
- moves the 'set-badge' callback outside of the window creation because it only uses the global `app`, and was duplicated with every new window unnecessarily