How do I programatically close the tinymce dialog in wordpress?

javascript, tinymce, wordpress

Solution

From within the popup, I call the following:

parent.tinyMCE.activeEditor.windowManager.close(window);

Problem

If I type into the Javascript console: tinyMCEPopup.close(); It returns: TypeError: Cannot read property 'windowManager' of undefined Thanks!

Original source