High power single-frequency and frequency-doubled laser with active compensation for the thermal lens effect of terbium gallium garnet crystal