Denti,
And why did they cease A340 production? ... Because the beancounters decide upon costs before safety and opt for A330's instead!
But just because they recently ceased production doesn't mean that the type won't be flying for another 20 years or whatever.
And the B747-800 probably isn't selling so well because there are fleets of B747-400's with plenty of life left in them yet.