What if you did

    stream do |stream|
      # io stuff
    end

so that file operations are still contained in the 'stream' block defined in io?