I know `ensureOpen` is expected to throw an exception here, but I'd rather have an explicit `throw someException` here to make sure that it won't just go to the next iteration of the loop.