In general, you will see a black modal window after executing the script. (startup.bat/startup.sh)
Just simply close that dialog, then CodeGen will exit automatically. For more approaches that shutdown the CodeGen service expediently, we will consider proper solutions and upgrade its related logic in the following versions if possible.
Factually, there's another way to shut down CodeGen service with ease, please refer to the screenshot below:
Settings > Control Panel > Shutdown Service