I believe I can help you with this issue.
When you are ready to save your work, you need to click file ----> save as.
This will bring up the save as box showing the directory you intend to save the file in. Here is the part to pay attention to

.
Towards the bottom, you will see a field labeled "Save as type:". This field needs to be changed to "all files"
Once you have selected all files. Save your work as filename.dm .
This will save the file as an actual dm file instead of filename.dm.txt like you are doing currently.
I hope this helps!