Possibly the file that you try to open does not exist or you have no permission to read it … try to protect your code … I modified my example source code, in my previous post, accordingly.
Another possible reason is covered by: [url]Copying object from tfiles