Adding cleanup on execution of AllModes.