In-depth analysis of chloride treatments for thin-film CdTe solar cells