Influence of wall thickness on the stability of the resistive wall mode in tokamak plasmas