A server will remain active as long as there are players in it. After the last one has left, it will save the world progress so that you can come back to your structures and other progress once it is opened again.
Important note! This does not apply if you decide to delete it. Also, servers will be deleted after 90 days of inactivity.
In Single Player mode, the game is saved each time you return to the Main Menu from the game. If you switch off or reset the console while playing in a map, your progress in that game session will be lost.