Probing impurity migration effects in Si-doped AlGaAs by terahertz spectroscopy