Under certain circumstances, Brackets would crash application:openfile: because [theApplication keyWindow] was null. This can occur if keyWindow has never been assigned, or if Brackets was hidden or inactive. The fix is to try mainWindow if keyWindow is null, and then to try *any* window if mainWindow is null.