Search for dark matter produced in association with a Higgs boson decaying to two photons in proton-proton collisions at 13 TeV with the CMS detector