fix socket pool

- make sure that all sockets are correctly closed when the pool process terminate
- don't store closed connection if we know it.