SD Card seems to run in the background

I'm just starting to use an SD card on Arduino Nano. Ran the example CardInfo.ino file. This works just fine. Copied this code to my working directory.

Started working on learning the functions and noticed a weird behavior with

I added code to open SD and then check for "MYDIR" and if it does not exist create it. This added code is after in the setup(). See attached code below. The result was listed what was to be created as a file and not a directory. Adding a delay(3000); after the fixed the issue.

This seems like a bug.

I've appended code to the setup() routine after line 119
// list all files in the card with date and size | LS_DATE | LS_SIZE);

my code... SDCardIntroduction.ino (5.3 KB)

executed monitor results... execution results.ino (770 Bytes)

line #20 has "MYDIR"... yet it was not created until after

Also when this is done it is not even a directory. It was created as a file. see this image... windows 10 file manger screen capture

Adding a delay(3000); after results
withdelay.ino (743 Bytes)

Verified with windows10 file manger.... MYDIR was properly created