Can a sealed environment go on perpetually?
Ideally, yes. In reality no -- at least none that man has been able to create or is ever likely to. Ecosystems are incredibly complicated. There is so much we don't know about how one interaction affects others and factors we likely aren't even aware of as yet. So plan on periodically working on your terrarium.