High-precision spectroscopy of ultracold molecules in an optical lattice