puter.ui.exitPictureInPicture()Closes the picture-in-picture window opened with puter.ui.requestPictureInPicture(), if one is up. Its onClose callback does not run for this — you asked for the close.
puter.ui.exitPictureInPicture()
A Promise that resolves to true if there was a window to close, false otherwise.
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<button id="exit">Exit picture-in-picture</button>
<script>
document.getElementById('exit').onclick = async () => {
const wasOpen = await puter.ui.exitPictureInPicture();
console.log(wasOpen ? 'closed' : 'nothing was open');
};
</script>
</body>
</html>