Write out mapfile and cfgfile on load