I've done the same thing often enough that it really pisses me off some days.
It's basic computer habits across /any/ software that you 'close' things by going upper-right. And since Autocad moved the 'close drawing' button from being at the top-right of the overall window, to being inside the _DRAWING SPACE_ (seriously who thought that was a good idea?) overall intuition/ergonomics seemed to make me think the close button in the drawing space was to close the current operation / block editor. And since I'm used to hitting a quick key whenever the inevitable popup of yes/no/cancel pops up, I never made distinction between that popup and the 'close block editor' popup.
So annoying.
However, setting "MENUBAR" to 1, like I have it, will put it where it should be. If you're not someone who ever wants the menus up, I guess it's a case of picking the lesser evil.