Fix concurrency issues, close all pool connections on shutdown