We need to check for file != NULL, which is true in the case we just started expanding the directory.