Replace ::File.open with file resource