Elaborate shutdown mechanics added

Guard against the CEF shutdown semantics