This will wait for all child processes to exit.
Don't you really want:

  wait $sampler_pid