Record termination time in state.

Supercedes pull #1946