data: close file if result is not iterator