Or would it do the trick, if I would properly close the file at the end of each loop and re-open it again (and how DO I close it properly)?
Whether it would "do the trick" or not, it should be done.
- there is no "logfile.close()" line in the example sketch (or however the file might be closed). I understand that this is not a problem in an endless loop, but...
I think you know HOW to do it.
- What exactly happens if I close the file, is there some kind of end tag or so?
A number of things happen, not the least of which is that any pending (buffered) data is actually written to the file.
You can then open the file for append, and the SD library figures out where to write to the file.
Be aware, though, that opening and closing the file are not terribly fast operations. Buffering data, and opening the file when the buffer is (nearly) full and writing the whole buffer will reduce the number of times that you need to open and close the file. On the other hand, it increases the risk of lost data. How much data might get lost depends on how big the buffer is.