onBeforeSave & onAfterSave issues with Lightbox

The page is channelvillebeta

The lightbox Profile is triggered if the user profile has not been completed. The lightbox Profile is the issue.

Currently, I have the following code that closes the lightbox, but it didn’t work so I commented it out.

$w(‘#dataset1’).onAfterSave(() => {
wixWindow.lightbox.close(“Profile”);
});

Instead, I have to close the lightbox in the onBeforeSave with a timeout and some validation to make sure it’s OK to save.

       setTimeout(() => { 
            wixWindow.lightbox.close("Profile")  
        }, 3500);