Apex Trigger
trigger OpportunityTrigger on Opportunity (before update) {
for(Opportunity oppNew : Trigger.New){
for(Opportunity oppOld : Trigger.Old){
if(oppOld.StageName=='Closed Won' || oppOld.StageName=='Closed Lost'){
if(oppOld.StageName!= oppNew.StageName){
oppNew.StageName.addError('You can not update the stage name');
}
}
}
}
}