Fix #1171200, #1331893 and #1075472 - Fix potential crash on exit.

I ran into a situation where if I opened an image from the Recently Used
pane in the Gnome File Chooser, the dialog could return null when asked
for the current directory.