Added When Exit Function (Safe Exit)
Added When Exit Function (Safe Exit)