Autocomplete close event

Hi
I am spoused to remove class from the body when the autocomplete dropdown closed, but when I am trying to use autocomplete:closed it’s not working the closed event working only if I am clicking on one of the search results, I want to ask if there is any event that can recognize when the dropdown is closed without clicking on one of the search results
please advice

autocomplete(’#aa-search-input’, {
debug: true,
cssClasses: {
dropdownMenu: “dropdownMenu suggestions p-2”
}

}, [
    {
        source: autocomplete.sources.hits(config.searchClient.initIndex(config.productsIndex), {
            hitsPerPage: 6,
            distinct: true,
            clickAnalytics: true
        }),
        displayKey: 'products',
        name: 'products',
        templates: {
            header: ''

                + '<div class="header">'

                + '  <div class="widget-title">' + algoliaData.strings.products + '</div>'

                + '</div>',

            suggestion: function(product) {
                if (typeof(product.image_groups) === "undefined"){
                    product.firstImage = algoliaData.noImages.small;
                } else {
                    var smallImageGroup = product.image_groups.find(function (imageGroup) {
                        return imageGroup.view_type === "small"
                    });
                    product.firstImage = smallImageGroup.images[0];
                }
                return productSuggestionTemplate.render(product)
            }
        }
    },
    {

        source: autocomplete.sources.hits(config.searchClient.initIndex(config.categoriesIndex), {
            hitsPerPage: 6,
            distinct: true,
            clickAnalytics: true
        }),
        displayKey: 'categories',
        name: 'categories',
        templates: {
            header: ''

                + '<div class="header">'

                + '  <div class="widget-title">' + algoliaData.strings.categories + '</div>'

                + '</div>',
            suggestion: function(category) {
                return categorySuggestionTemplate.render(category)
            }
        }
    }
])
.on('autocomplete:shown', function(event, suggestion, dataset) {
    var bodySlecttor = document.querySelector('body');
    bodySlecttor.classList.add("menu-open");
    console.log("Open");
})

.on('autocomplete:closed', function(event, suggestion, dataset) {
    var bodySlecttor = document.querySelector('body');
    bodySlecttor.classList.remove("menu-open");
    console.log("close");
});

Hi @amontecalvo, I have created a codesandbox with your function for the autocomplete:closed and it appears to be working when I click off the search box and the dropdown closes without selecting an item from the dropdown. Could you use this codesandbox as a starting template to demonstrate the issue you are having?