Ref T13302. The "Close/Cancel" button is currently running two copies of the "dismiss dialog" code, since it's techncally a link with a valid HREF attribute.
An alternate formulation of this is perhaps if (JX.Stratcom.pass()) { return; } ("let other handlers react to this event; if something kills it, stop processing"), but pass() is inherently someone spooky/fragile so try to get away without it.