The best way to prevent losing work in Twine is to back up your work regularly.
App Twine makes a backup copy of your work every time you start the application, and every 20 minutes while you are working. By default, it creates a folder called Backups next to the story library folder. That is, if your story library folder is in Home › Documents › Twine › Stories, your backups are in Home › Documents › Twine › Backups.
The location of your backup folder can be set using a command-line switch.
You can also keep backups of your own by copying your story library folder, or individual stories, to another location.
You must keep backups yourself using the Archive feature.
You may not be completely out of luck.
In addition to automatic backups, app Twine creates files in the scratch folder. Files in this folder are created when you play, test, or proof a story. You may be able to recover your work from files here.