The distribution of impurities in the interfaces and window layers of thin film solar cells