better logging
add a close callback