added option to prevent writing context trees at times t^k and make the agent terminate at terminate-age exactly (was terminate-age+1)