Effects of thermal lensing on stability and astigmatic compensation of a Z-fold laser cavity