close map file so that the agent can be reloaded

Tidied up pull request...