Clean up global state when job finishes

Change-Id: Iff001ac95c0d7236c58434fddb843a52f32aa202
Merge "Clean up global state when job finishes"