Added check for hb_handle on close