`join(5)`?  At this point, the threads should have already finished, `join(0)` should always work... have you seen this fail in testing?

Also, if the thread doesn't join, the test probably should be marked as failed, since the AS script didn't complete.  To give good diagnostics here, I'd almost suggest taking a leaf out of `Timeout`'s book and throw a (custom) exception in the blocked thread and re-call `join` to catch the exception and dump a useful backtrace.

Lastly, I think the code that prints `SUCCESS` needs to be moved to after this cleanup, since some failures should fail the test.