Stability and transition of stratified natural convection flow in open cavities