nit for the comment:

Helper function for removing notifications. It will fetch the notification
using the current threadId or the parameter if provided,
and close them from the returned list.