handle failure of closedir