Add an implementation and test for map.destroy that fixes #1101