window: Clear the weak ref before freeing the data

This fixes a crash introduced in commit 9f2ba3d5b642973a21e7916fe1a60a5c44126720.

https://bugzilla.gnome.org/show_bug.cgi?id=706349