I also stumbled upon this exact same error when I wanted to profile a Spring web app running on a Tomcat. It also crashed my IDE (IntelliJ IDEA 2024.2.3 (Ultimate Edition)) each time I tried to stop the profiler.
I found that if you want to stop the profiler when you want, you have to launch Tomcat normally, THEN attach a profiler on its thread. You can then stop the attached profiler without issues and read results.
To attach the profiler on a running Tomcat, follow these steps :
This doc page from jetbrains helped me found this feature : https://blog.jetbrains.com/idea/2021/10/5-best-features-for-profiling-java-code/#easy_run_fast_results