Thermal dynamics and active control of an optical reference cavity for space applications