Remove using of open file handler

Listing too many files in a bucket fails because of too many file descriptors are opened.