check exit code on close
call callback once