Window.frameElement is a node, which keeps the current window. CommitPopup () method requires the pop-up and closes the side windows. Thus, simply by calling the above method, the dialog box closes automatically.
This is a very nice tip, which helps some custom implementations. Hope that helps.