WICKET-4909 ModalWindow overwrites window.onbeforeunload

(cherry picked from commit 637690f59dae71408b4f23ba34e3350e82aa78a2)