Headspace analysis of volatile impurities in solid polymers