Check whether connection-pool is empty before closing it.