fix test bug: close iterator