There are two ways to quit it:
1. Send the command a break in the shell, then type quit in the window that'll pop up.
2. In the uae archive there's a command called uaectrl. Run it from the emulator and it'll give you a list of options. The third one quits.