only close pool if necessary