South Africa needs to be careful that it doesn’t repel badly needed foreign direct investment as a result of its crackdown on immigration