Structure and magnetic properties of off-stoichiometric Y2Co17 and Gd2Co17 compounds