Avoid error-ing out when shell provides a valid focused app but no matching window

Check for a null window handle before trying to do all the title retrieval logic to avoid errors.

Also makes indentation uniform in extension.js, was bugging me out.