Fix updateMulti timer leak after multiple Viewer.open() calls

Keep a counter of `Viewer.close()` calls in private state and a copy in the timer's closure, and stop the timer when they no longer match.

Also clean up some nits I discovered along the way.

(What sort of granularity do you prefer for pull requests?  It seems silly to open one small pull request after another, but I don't know if you'd want several unrelated fixes in a single pull.)