Purification of chlorine-containing wastewater using solvent extraction