SDFat - how to open 1 file close it and then open another

I am using SdFat and reading data from one file and then closing that file.

I then attempt to open another file and read data from it but I get a "File not found" error.

If I comment out the first file read, and make no other changes, the second file open and read works perfectly. Thus this is not a case of the file name being incorrect.

I have searched google and the forums but have not found an example of how you can open one file / close it, and then open the another file.

I am using the command

bmpFile.close(); to close out the first file before attempting to run this code:

// Open requested file on SD card
if ((tftFile = sd.open(filename)) == NULL) {
Serial.print("File not found");
return;
}

At which point I get the File not found error.

Thanks for your help.

You posted a snippet of code, so I'll post a snippet of an answer.

On line 42, you need to...