window: Placate new gcc

It thinks remaining can be used uninitialized. It's wrong, but let's
help it out by initializing the variable.
config: Fix an incorrect unref
config: Combine two exit paths