Calc files with Macros crash LibreOffice (Mac) when they are closed

Calc files with macros crash LibreOffice when I close them. It’s been a problem ever since I started using LO about 6 years ago. I’ve tried different profiles, different users, safe mode, etc. but none of them work. This is a new Mac and when I activated it I created new Mac Profiles and downloaded a new, fresh install of LO. Only files were transferred from the old Mac - no settings, profiles, etc. and the problem remains. If I open files with macros disabled then the problem still happens. Closing files without macros does not crash LO. I only use macros with Calc so I don’t know if this is a problem with the other LO apps.

Version: 25.2.3.2 (AARCH64) / LibreOffice Community
Build ID: bbb074479178df812d175f709636b368952c2ce3
CPU threads: 12; OS: macOS 15.5; UI render: Skia/Metal; VCL: osx
Locale: en-GB (en_GB.UTF-8); UI: en-US
Calc: threaded

Java Oracle 21.0.1

1 example ?