Fix msenvironment when empty and used with dumb backend
This is an improved version of #1514 which was finally reverted in #1517.
Empty environments used with the dumb backend, when this is never correctly closed [*],
fails to open with the 'w' flag. This is because the .dir
file is never created
and it is necessary to determine the backend by the dbm.whichdb()
.
Avoid this problem by always closing the dbm. Actually this is only necessary for the dumb backend but do it for gnu as well - it does not harm and makes the code cleaner.
[*] The MacroServer process currently crashes at exit - see: #719
Fixes #1425 (closed).