Added support for window.close from modal dialog