check for iTerm window before trying to close it