Support downgrades to previous version in the case of aborted upgrades

In some cases upgrades will need to be aborted and the best course of action will be to restart to the previous agent version. This PR modifies the upgrader worker and machine agent so that it will allow downgrades
to the pre-upgrade tools version, but only if an upgrade is still in progress. This allows the upgrade-steps worker to trigger a downgrade to the previous agent version by changing the environment's agent-version.