avoid unnecessary clients and close broken connections

1. Previous pool would hold all the connections(size of 'poolSize') even if just one connection can process all the requests. So this PR would create clients as more as necessary and close them we do not need them.
2. Broken connections would be returned to the pool and no other connections are able to be created in previous code. This PR fixes this.