removed croak calls
cosmetic change
fix usage of close instead of closedir