Don't reference a filehandle outside scope.
Merge pull request #10811 from cachedout/highstate_cache_bug

Don't reference a filehandle outside scope.