Script with long process exits early from -b via commandline

Hey there.
I’m working on a script to convert an image into tile data.
this works fine with the dialog options. I’m trying to add commandline batch processing to it too.

now when I run my script from a shell I pass in -b and -script-params and it does work . BUT
control returns to the shell immediately and then after processing is done it prints out my messages to say it’s completed.

is there anyway to force asesprite to stall/not return to shell until the script is finished ?
also it seems to require me to press enter once it’s actually finished ?

this makes it problematic to use via a makefile for example