invoke closedir after invoke opendir
closedir when succeed
Merge pull request #9404 from super626/v3

bug fix
[ci skip] Update CHANGELOG
Merge pull request #9401 from minggo/iss9398-not-close-dir

invoke closedir after invoke opendir