multiqueue: fix potential crash on shutdown