fixed on-close callback bug