How do I close a palette?

Some palettes close when I hit esc, some don't, I think it's the "nested" ones. I want to be able to do this: open the palette and then close it, regardless if I do or don't hit any shortcut inside it.

Thanks!

Use Hide palette action