How to diagnose a terminal crash?

Have you fixed it? I meet a similar crash when I use multi-threads.

Windows locks files that it accesses. Perhaps the file remained locked from a previous run?