Generation of nanosecond THz pulses using a high gain ring resonator with a semiconductor switch