Check if window exists before using them
Hack to prevent focusing views in closing group(s)