Search for invisible decays of Higgs bosons in the vector boson fusion and associated ZH production modes