Dissipative effects on a scheme of generation of a W state in an array of coupled Josephson junctions