fix container restart race condition

Finish container cleanup before setting the state to stopped.
Otherwise, for an application that exits quickly, a call to Restart
can allow Start to be called again before cleanup is done, resulting in
overritten data in the Container struct.
Merge pull request #2748 from jpoimboe/fix-restart-race-condition

fix container restart race condition