Gupta coal mine and terminal to be retained by SA govt after court decision