added external closePopup method