Well, on Raphael's Library you find press(), then you can make press('[ESC]'), or you use keyevent(), they're all the same thing. stopattack just presses esc, and that's what you need to close market, press esc. I understand what you mean about making the name intuitive, but it really doesn't make much sense. Don't take it as an offence though.
Btw, most of newcomers don't even know what a library is and where it is located, I'm sure you will find your way with ease with all the functions we have available =)