I've tried to derive the relation between free energy, $F$, and equilibrium of a closed system. From the derivation i've written below it seems that if $T$ is constant and the system can't exchange work with the environment then, $F$ is at a minimum. If my reasoning is correct, can you give me an example of such a system that is not just an isolated one?
derivation
$$dE-\delta W =\delta Q \\ dS \ge \delta Q/T $$
substituting
$$dE-TdS \leq \delta W $$
using the definition of the free energy
$$F=E-TS \\ dF=dE-TdS-SdT $$ considering an isothermal transformation $$dF=dE-TdS$$
substituting again $$dF \leq \delta W=0 \\$$
It follow that if the system can spontaneously evolve it will reach a state with less free energy. So, if there aren't available states with less free energy the system can't evolve, namely it is in equilibrium.