Handle case where instance is already terminated.

Change-Id: I220d508534e8c48cc1c006db48c79a67fd37a255
Properly encapsulate instance terminate in cleanup.

Change-Id: Ia5d4dda4b735ce633165e231e4455df5a34ed0b6
Fix spacing.

Change-Id: Ic75bf12d511da788a642921f2239d5c769ecbc24