waiting for each worker thread to terminate

In the previous version we were only waiting for the last-initialized thread to finish.
Unless I missed something, I guess that was not the intended behaviour.