Fix crash at closing on OSX (Qt4)