* close directory after checking file type