I have done this before with JOIN on multiple files with no problems. Just make sure the data structure you fetch into is defined to match the fields on your SELECT.
All fields will be defined in the same data structure. This makes it kind of hard to just define the data structure externally to match a particular file layout. Are you pulling in all fields from each file in the join? You could create a dummy file containing all fields from each file being joined in the order the SELECT pulls them in and then use this empty file just to define the data structure.
The one problem you might run into when joining depends on if you are doing a straight join or a left join. With a left join you could get null values pulled in on secondary file fields and if you don’t define the fields on your SELECT with an IFNULL or COALESCE to set the input data to zeros or blanks, this could cause a problem on the fetch.
Sorry but this does not answeer the question of how to join more than 2 files