Wait for all processes to end.