Fix an issue where the window controller's document would become nil.