Due to the way the markers were being sorted and placed, two issues had arisen: (1) when calling closeMetadata(), the markers were not added back in the sorted order, which was causing problems; (2) I had accidentally used the index of the sorted markers as the currentMetadata, but I needed to use the original indices, because of how the cards are created.
Due to the way the markers were being sorted and placed, two issues had arisen: (1) when calling closeMetadata(), the markers were not added back in the sorted order, which was causing problems; (2) I had accidentally used the index of the sorted markers as the currentMetadata, but I needed to use the original indices, because of how the cards are created.