Hello,
The answer to your question I think that it's very simple.
In the attached picture you see two ways that you have to read the file. One it's direct and the vi open and close (second way in the picture). The other you have open, then read, at the end close.
It 's this the answer to your question.
Software developer
www.mcm-electronics.com
PORTUGAL