ctl_on_done: register and call handlers on application exit event

Signed-off-by: Oleg Verych <olecom@gmail.com>