Impurity removal from Si by Si-Ca-Mg ternary alloying-leaching system