Maybe it could be something related to the animations? stuff like that can be very elusive. When the game locks up, you are able to like open menus and move pieces and stuff, but when you let go of them they just hang and don't snap to a square, and when it froze after using swap I ended up getting multiple pieces rendered on the same square.
Finds: Upon opening a board with boosters or portals, they won't animate sometimes, and the game stops working, so it's occurring the moment the board is loaded or maybe even before! Background still animates tho, even when the game is locked up.
The issue can occur on any board but seems less common on the first few boards with no elements
The issue can occur even if only playing the same board multiple times
The issue can occur whether the previous board resulted in a win or a loss
Returning to menu between boards seems to prevent the issue. (As a super janky fix you could prob just call the code that takes it to the main menu and then call some more code to go back to the level select screen after every board, and then maybe removing some of the code until it breaks could also help isolate the issue)
Hope some of this helps!