Fix crash when removing surface after releasing mouse outside window