Use more robust way to keep the timer reference alive.

Strict mode generates a warning about |timer;| being a useless
expression, which suggest that this might be optimized away at some
point (see also https://bugzil.la/640629#c9). Instead, explicitly
store the timer in the observer object.