I made some changes, however I think I had never implemented window.close(), maybe this worked previously by accident. I think I can add support for it, or you could instead call the hide floating menu action:
let menu = { BTTMenuActionMenuID: "TheNameOfTheMenuYouWantToClose" };
let result = await trigger_action({
json: JSON.stringify({
BTTPredefinedActionType: 387,
BTTAdditionalActionData: JSON.stringify(menu)
}), wait_for_reply: true
});
//edit: I have implemented window.close() for floating menus in 5.481 (uploading)
//edit2: v5.482 should prevent conflicts if also standard floating webviews are being used