function handleProfileCloseResponse(confirm, cbinfo)
    peInstance = cbinfo.Context.Object.AppObject;
    
    if strcmp(confirm, DAStudio.message('SystemArchitecture:ProfileDesigner:Save'))
        % Save and then proceed to close
        pe.toolstrip.handleClickSaveProfile('save', cbinfo);
    
    elseif strcmp(confirm, DAStudio.message('SystemArchitecture:ProfileDesigner:Cancel'))
        % Abort
        return;
    end
    
    % Don't close the profile if there are open models that use it
    [hasUsage, usages] = pe.toolstrip.profileHasOpenUsages(profile, peInstance);
    if hasUsage
        dp = DAStudio.DialogProvider;
        eDlg = dp.errordlg(...
            DAStudio.message('SystemArchitecture:ProfileDesigner:ProfileHasOpenUsages', ...
            profile.getName(), strjoin(usages, ''', ''')), ...
            DAStudio.message('SystemArchitecture:ProfileDesigner:CannotCloseProfile'), ...
            true); % non-blocking
        return;
    end
    
    % If the Profile is being used by copied elements on the Simulink Clipboard
    % Clear Stereotypes and Property Values on all copied elements
    if pe.toolstrip.profileHasOpenUsagesInScrapArch(profile)
        Simulink.SystemArchitecture.internal.ApplicationManager.clearScrapArchitecture;
    end
    
    % Close the profile
    pe.toolstrip.closeProfile(profile.getName(), cbinfo);
end