Number of open files (Dir's) how to close?

I am having a client/server application which will download files from server. If server has directories, it will create directories/sub directories and then download files. In this process, I observed that number of open files are more than 400 (which is approxmately same as number of dir/subdir that I downloaded from server) using "lsof -p pid" command. The o/p of lsof command has "DIR" Type files with file descriptor as "Read".
I did't understand why the Type "DIR" is in read mode. Under what conditions it will take place?

Just about anytime the directory is being read -- possibly by lsof itself. It can also be in read mode if there is a process that set its current working directory (setcwd()) to that directory. It might also be becuase a process opened the directory for reading, but never bothered to close it, and that this process is still running. (A buggy FTP server perhaps?)