DoCommand: modify logic a little to give mpirun a little time to cleanup

We used to kill() mpirun and then immediately waitpid() for it, and
then warn if mpirun wasn't already dead.  But we really need to give
mpirun a little time to clean everything up.  So instead, do something
like this:

  foreach sig (SIGTERM SIGINT)
    verbose "Killing with $sig"
    kill pid with $sig
    for (i = 0 .. $wait_time)
      sleep(1)
      waitpid(pid, NOHANG)
      if killed or nonexistent, return
    verbose "Didn't seem to die with $sig\n"

So we basically kill it and wait up to 5 seconds, periodically
checking waitpid() to see if mpirun has died yet.  This should give
mpirun time to clean up and actually die.

If the above loop fails, we still fall through and SIGKILL until
mpirun actually dies.