will wait to terminate if status is still running

It gave a false negative and returning an error code of 2 if the status was running, so now it waits until the status isn't running before terminating.