The Beanshell Editor has a "Close" button in the toolbar. This button can be removed as the window already has a close button. The code is in scripting/java/com/sun/star/script/framework/provider/beanshell . You find the Beanshell Editor via Tools->Macros->Organize Macros->Beanshell. Create a library, then a macro, then you can edit it which gets you into the Beanshell Editor.
EL-SHREIF committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/+/ca8eef6be3e45b934879780e847d6ef4faba857a%5E%21 tdf#123589 Removing close button from toolbar in Beanshell editor It will be available in 6.3.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.