Use semaphore instead of lock for opening.