Cause forward message logic to return once all threads exit

This prevents a deadlock if some threads were unable to get all
return codes.