add locking to open