Thanks to visit codestin.com
Credit goes to perldoc.perl.org

closedir DIRHANDLE

Closes a directory opened by opendir and returns the success of that system call.