added semaphore access to file