avoid potential memory leaks by destroying the pools after A and G steps