Fixed cleanup code to do the proper exit code.

Change-Id: I7a23aebb0202964c8e045bf916744d83574c2560