Fixed incorrectly showing close buttons on tabs after restoring session.

Only reproducible when tabs overflows the tabbar.
Also fixed build warning on Windows.