Fix crash on close patch rebased for stable

Not sure why I pushed it for master, really. Maybe an oversight... well, it's good that it got some testing in master before being sent for stable, though.