The closedir() function closes the directory stream referred to by the argument dirp. Upon return, the value of dirp may no longer
point to an accessible object of the type DIR. If a file descriptor is used to implement type DIR, that file descriptor will be closed.