Fix issues with teardown when builds are cancelled

- If a build was cancelled during slave setup, the master
tried to deallocate and teardown the slave twice.
- If a build was cancelled and then the master received more than
one subjob result, the master tried to perform postbuild tasks multiple
times
Add tests for teardown fixes
Merge pull request #54 from box/fix_teardown_during_cancellation

Fix issues with teardown when builds are cancelled