Fixed missing closedir