Ensure all task state changes go through task.py and the run-db.

Some task state changes (in and out of the 'held' and 'runahead' states,
which has no consequence for other task state variables) were being
actioned by direct access to the task state object without going through
the task proxy class and updating the new run-db.
Run suite shutdown handler at the last.
Merge pull request #245 from hjoliver/run-db-task-states

Ensure all task state changes go through task.py and the run-db.
Merge pull request #247 from hjoliver/suite-shutdown-order

Run suite shutdown handler at the last.

Merged on behalf of @arjclark.
Merge branch 'master' into final-config-changes