[BUG] fix segfault at exit when using captures

since pools v2, the way pools were destroyed at exit is incorrect
because it ought to account for users of those pools before freeing
them. This test also ensures there is no double free.
1 file changed