cmd/jujud: upgrade mode end fix

Fixed a case where upgrade mode wasn't being stopped when it
should. This is actually almost impossible to hit in practice but good
to fix anyway.

Added a unit test to cover this case.
Merge pull request #779 from mjs/upgrade-mode-fix

cmd/jujud: upgrade mode end fix

Fixed a case where upgrade mode wasn't being stopped when it should. This is actually almost impossible to hit in practice but good to fix anyway. 

Added a unit test to cover this case.

http://reviews.vapour.ws/r/48/diff