I got this to work by removing the Webflow.push wrapper and making sure the DOM is loaded before removing the empty slides
<script>
document.addEventListener("DOMContentLoaded", function(event) {
$(".w-condition-invisible").remove();
});
</script>