added file close
added counting semaphore. max number of files opening at at the same time is limited 10.