write map to file