Make sure the end_cb is called before exiting and check that it's callable.