Entropy is a measure of how much in equilibrium a system is.
A simple example.....
Imagine a sealed room in which no air or heat flows in or out.
In it are 2 barrels of water.
One is hot. One is cold.
This is a "closed" system because nothing flows in or out.
It's not in equilibrium because of the temperature difference.
The temperature difference means there's "available" energy to do work.
A Stirling engine does this easily.
The different temperatures mean the system isn't in equilibrium, so entropy is not at a minimum.
Let's say the heat engine uses all the available energy to lift a weight up a few feet.
Now the barrels are at the same temperature, so they're in equilibrium, ie, no thermal energy is available to do work.
But the weight has potential mechanical energy to do work.
Since no heat engine is 100% efficiency, the potential mechanical energy created is less than the available thermal energy lost.
So entropy has increased.
Now, let the weight fall, & generate heat.
There 's no more thermal or potential mechanical energy available to do work.
Everything is in equilibrium, so entropy is at a maximum for this closed system.
I don't know how clear this is, or whether it answers your question.