Chemical control of optical damage in lithium niobate