Cleanups.
Fix regression introduced in 16e486e.

Explicitly select the first tab if the caller hasn't done so by the time
we're attached to the window.