fix sem_open and sem_close to obey posix semantics