South Africa closed its border with Mozambique shortly after opening it as post-election violence in the neighbouring country escalated, leading to clashes between protesters and the police.