Waiting for multiple processes to exit