closePopup func scope fixed