Updated to enable callback on close