Fix fd leak in DIR ccache cursor function

If dcc_ptcursor_next reached the end of a directory, it called free()
on the directory handle instead of closedir(), causing the directory
fd to be leaked.  Call closedir() instead.

(cherry picked from commit c29d5f61af301aa8993b01ed0e3eb4f529d6862c)

ticket: 7573
version_fixed: 1.11.1
status: resolved