saves theta after every iteration