Fix for close callback fired twice