Title Not Collapsing when supposed to

Question:
I have collapsable sections on the page Graphic Artists (Artists Name) page but the title "Commission Gallery will not collapse, how can I fix this
Product:
Wix Studio

What are you trying to achieve:
I am trying to get the title "Commission Gallery to collapse like the gallery itself does.
What have you already tried:
I’ve tried adding the title to the code

Additional information:

import wixWindowFrontend from 'wix-window-frontend';
import { session } from 'wix-storage';

$w.onReady(function () {
    $w("#dynamicDataset").onReady(() => {
        let itemObj = $w("#dynamicDataset").getCurrentItem();

        // Trigger lightbox for age verification if the content is mature and age is not yet verified
        if (itemObj.isMature && !session.getItem("ageVerified")) {
            wixWindowFrontend.openLightbox("Adult Lightbox");
        }
        
       // Expand section for featured series if applicable
        if(itemObj.additionalInformation){
            $w("#textTitleDetails").expand();
            $w("#textDetails").expand();
        }
        // Expand section for example gallery if applicable
        if(itemObj.mediagallery){
            $w("#sectionExampleGallery").expand();
        }
	
	// Expand section for commission gallery if applicable
        if(itemObj.commissionGallery){
            $w("#sectionCommissionsGallery").expand();
        }
        
    });
});

The code provided causes elements to expand rather than collapse. Can you perhaps share a screenshot or screen recording of what is not working?