MDL-26337 Improve close_window. Fix bug when $reloadopener is false, and better usability when it is true.