Thank you Adrian, Brian. I've been experimenting too and also think the operating system has a list of windows ordered by "last time used." After closing the current window, the operating system moves the keyboard input focus back to previous window in this list; more specifically it moves it to the last touched control type in the previous window. That's my theory, at least.