Starting document autoclose
Automatic document closing
Adding check to close doc only if one exists
Fix merge conflict
Merge pull request #7 from OpenDTP/dev/ref#29

Dev/ref#29