add callback on close