Just open your text editor, write M18 on first line, save the file as stepper_off.gcode (or whatever).
Insert the file at the root of your USB stick and whenever you want to de-energize your stepper motors without waiting to move the toolhead manually, just “print” the file.
How to test:
Move Y or X or both from the screen menu, the head is locked
Run the file, the head unlocks