A few things - none of which will probably solve your problem - after all it
is DBPro we are talking about here!
First of all, it's very common to see the / symbol used in file paths, when it should be \. Forward slashes should only be used in web URLs, though it's so common, it must work in DB!
Secondly, in the code, if whereStr$ is not found, the program jumps to _notfound: which is after the file is closed. Subsequently, the file isn't closed.
Thirdly, you should never use Goto to get out of a subroutine you have called with Gosub. Set a flag in the procedure and jump to the Goto if absolutely necessary after you have returned from the Gosub.
Finally, have you tried opening the file with channel 1 instead of 2? There may be a good reason why 1 wasn't used, but if not, it's worth trying.
You also seem to have more tiles down than across in your For...Next loop. Is this intentional or do you have the X and Y back to front?
Maybe one of these 'unconnected' points will help.
TDK