Propagator for the general time-dependent harmonic oscillator with application to an ion trap