One thing, is you might want to try it with do shell script, not do script. Secondly, you might also try throwing delay 1 into the repeat loop. So it will delay quitting a second for every second the command is still running. Lastly, maybe instead of closing myTab, just use the quit command to quit Terminal.
I don’t work with shell scripts too much, so I can’t guarantee that these solutions will work. But it’s worth a try.
doesn’t work as intended: it does not do it’s work in terminal, so i don’t see the progress in the terminal window.
but i’m using the tip with the delay in the loop - and i found the right way to test for teh terminal window beeing busy:
tell application "Terminal"
set myTab to do script ". p365ago_screens.sh"
repeat until busy of myTab is false
delay 1
end repeat
display dialog "finished"
end tell