close popup while controller leaving