wait for writeChain to finish before releasing mutex