The opening on the underside of the leaf is called a stomata. Stomata are small pores that allow for gas exchange, enabling the plant to take in carbon dioxide for photosynthesis and release oxygen and water vapor. They can open and close to regulate the flow of gases and water vapor.
Stomata are shut at night to conserve water. When there is no light, plants cannot fix carbon dioxide. Stomata are usually open to allow entrance of carbon dioxide. A side effect is that water is lost from the leaves.There is an exception to this, however. CAM plants such as cacti and succulents open the stomata at night, store carbon dioxide as acids, and close them during the day to prevent dessication from harsh desert conditions.