Code not working in lightbox

It’s just not doing anything and I don’t get any messages in the developer console.
Using the same code on a standard page but replacing

wixWindow.lightbox.close();

with

wixLocation.to("/isw");

my code is working fine and the correct messages are displayed in the developer console.