Dialog: Safe activeElement access.

Fixed #9420 - Dialog: Close causes blur of window in IE9
Fixed #8443 - Dialog: "unspecified error" when using ie9 and iframe