You forget a crucial fact: There is an influx of energy from sun.
The whole earth as an eco system works in a similar way as the plant in the experiment. There is no contradiction. Law of Conservation of Energy applies as usual.
As for chemicals like water, plants return water to the environment to the great extent. It is actually amazing how much water evaporates from an adult large conifer during hit seasons - it is unbelievable. The similar logic can be applied to other chemicals. There may be off course a lot of complex chemical processes in such experiment. I guess after some time, perhaps 5 or 7 or 12 years, the system reached equilibrium, adjusting itself to the environment, and continued to function for so long.