gallery fix

Using the escape button to close a gallery wasn't sending the close event, meaning event handlers weren't unbound and duplicate events were bound on reopening.