With the current implementation of GenericMenu as far as I know it's only possible to close a menu by closing it via the draw function after it's already been opened.
This works in the sense that the menu closes itself, but it would be nice if the menu didn't open at all so the player doesn't have a hiccup if they try to open a menu when it might not be relevant.