Optimize pool closing