Thermal self-frequency locking of a doubly resonant optical parametric oscillator