Thermodynamics of nuclei and nuclear fragmentation