Change state before releasing mutex