UK’s most senior judge to retire at end of legal year