This way, the click listener is only active when your popup is shown on the screen. It will fire for any click, so you might need to check if the element is outside your popup, something like:

"{window} click": function(window, event) {
// event.target is the element that was clicked
if (this.element.contains(event.target) === false) {// Clicked element is outside of the component
// Close the popup
}}
}