handle close callback.