Remove modal window but allow sc_alert

Control app calls a modal blank app to run a process. I have it call the modal because it then shows a bar showing something is happening without having to do anything else. At the end of the modal app execute, if I put sc_alert(message) it works fine BUT of course the modal window stays open after OK. If I put the echo “window.parent.tb_remove();” to close the modal window, it skips the sc_alert. How can I close the modal window without skipping the sc_alert (any kind of "hey i am done) message will do here!