Close dylibs properly on Mac