Fixed slave to properly handle terminated tasks that have pending
updates.

Review: https://reviews.apache.org/r/11694
Fixed master to properly do task reconciliation when slave re-registers.

Review: https://reviews.apache.org/r/11229