No, magma is located in the volcano when it comes out it is called lava. Lava cools after it comes out. Magma is still heated as the volcano is.
Magma cools because it losses heat to its surrounding environment, either due to convection or contact process.
It can change to Igneous rock
Extruded magma (lava) can cool on the surface, or under water. Magma also cools underground, forming intrusive igneous rocks such as granite.
It gets cooler as it flows down the mountain & turns into rock.