add save on unload. closes #239
Merge branch 'enhancement-239' into develop: