[win32] Empty search box after switching in persistent mode
[win32] More consistent error printing
[win32] Some fixes for persistent mode

Use SetForegroundWindow instead of deprecated SwitchToThisWindow.