Add workaround for hang on linux

map.dispose needs called on exit or map may hang on Linux