The tribal wisdom around FlyerTalk is that closed accounts count toward average age of accounts until they drop off the report (about 7 years).
However, the length of history is determined by the oldest account. So it makes sense to keep the oldest (or 2 or 3 oldest, just in case something happens to the oldest) open, so that the total length of history continues to grow.