js/leaflet: Extracted close() method
js/leaflet: Extracted open(id) method