mq_notify: rework to fix use-after-close/double-close bugs