The role of the substrate on the mechanical and thermal stability of Pd thin films during hydrogen (de)sorption