Relation between dynamic and thermodynamic stability of relativistic stellar clusters with cutoff and gas spheres in a spherical box