The same problem happens when you click on any purchase menu but are unable to purchase anything, so for monsters and also when you are out of coins
It's actually possible to close, just confusing. You can close the buy menu with a right click, or by pressing escape. If the game is played in the browser on fullscreen, escape will cancel fullscreen and you need to press it twice.
I'm working on an update to clean this up and make it more intuitive to close.