put the popup-menu-close code a little earlier to make it feel more seamless