Customer sign up lightbox close

I have created my own customer sign up in a Lightbox and I am wanting the Lightbox to close once they have successfully sign up. This is my code at the movement it all works expect for the Lightbox closing after sign up. Does anyone know how I can change it so it closes.
Thanks

import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;
import wixWindow from ‘wix-window’;

$w.onReady( function (){
$w(‘#register’).onClick( function (){
let email = $w(‘#email’).value;
let password = $w(‘#password’).value;
wixUsers.register(email,password)
.then(()=>{
wixWindow.lightbox.close();
})
})
})�

This works perfectly for me and closes after registering details before moving onto my signup status page, then both names will be saved in contacts and once site member is approved the member details will be added to my ‘members’ database.

import wixUsers from 'wix-users';
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';

$w.onReady(function () {
    
    $w("#registerButton").onClick( (event) => {
        
   let email = $w("#email").value;
   let password = $w("#password").value;
   let first = $w("#firstName").value;
   let last = $w("#lastName").value;

   wixUsers.register(email, password, {
       contactInfo: {
        "firstName": $w('#firstName').value,
        "lastName": $w('#lastName').value,
       }
      } )
      .then( (result) => {
        let resultStatus = result.status;
  wixWindow.lightbox.close();
  wixLocation.to("/sign-in-status");  //Change the URL ending to whatever page you want to send the user to after they log in.
      } );     
    } );
    
});