South Africa beat Australia in fourth Test to win series 3-1