Philly Sheriff’s top lawyer retires after illegal contract revelation