Update MapFactory

Fix close() function when multiple references are held