Make some machine/unit agent tests more robust

Fixes: https://bugs.launchpad.net/juju-core/+bug/1361721

If a machine is marked as Dead part way through agent startup, as happens in some tests, the agent exits without realising it needs to terminate.
I don't understand why we'd check this here? entity is not refreshed after `openAPIState` is called, and `openAPIState` already checks Life().