Fixing closing overlays on ESC.

Every page in the overlay registers its own cancelOverlay event
handler which allows them to return to other overlays when ESC
button is pressed rather than the default main page.

reviewer: @mvrable