Bug #1007: Fix the console getting key focus when a reference becomes unavailable, even if the console is not visible