A closed-terrarium is a closed system containing a plant in it. Think of plant in a closed bottle that continues to survive for a really long time. This is a self-sustaining system. The plants obtain sun light through the transparent walls of the container and along with carbon dioxide and water vapors carry out the process of photosynthesis. During this process, glucose and oxygen are generated. These molecules of glucose and oxygen are used in the process of respiration, during which energy (in the form of ATP molecules), carbon dioxide and water are generated. This energy is used for growth and maintenance of the plant. This way, photosynthesis and respiration support each other by providing reactants to each other, i.e. products of one process are used as reactants for the other, thus making it a self-sustaining system.
Hope this helps.