Voting ends in South Africa's hotly contested local elections