Question about which script is focused after closing another script.

How does LinqPad decide which script to switch to whenever I close a script?

Most of the time it is the previously selected script, but not always.

Is it based on the length of time spent active?

If so what is the time limit?