Accounting for localized defects in the optoelectronic design of thin-film solar cells