using islice, closing connection each time