Multiple modal dialogs not closing on ESCAPE

When two modal dialogs were open (the one on top of the other), the top one would close on ESCAPE. A second press of the ESCAPE key would not close the second.

Also, when closing a modal dialog, the focus should be given to the dialog below it, if there is one.