Joe Root took four wickets on day four of England's third Test with South Africa to mark his best ever wicket haul in Test cricket.