Check for valid window