function terminateSlicedModel(msObj, slicedMdl, simHandler)
    %

    %   Copyright 2015 The MathWorks, Inc.
    if msObj.isSimStateSlice
        delete(simHandler);
        % We shouldn't save the model here to ensure checksum matches for SimState. 
    else
        if ~strcmp(get_param(slicedMdl,'SimulationStatus'),'stopped')
            feval(slicedMdl,'term');
        end
    end
end
