Fix crash when quitting with an infobar visible

When the infobar gets closed/destroyed it tries to focus the possibly
destroyed document, leading to a crash.