Close popup menu on Esc and after pressing outside