close modal correctly by passing hidden.bs.modal event to parent elements