initial support for mapscript environments (preparation for proper post-map-quit cleanup)