The bug
If the host of a LAN world closes the world while other players are still playing on that world, those players will be kicked with a java.lang.StackOverflowError
error message. The kick message should be something like "Server closed" instead.
To reproduce
Open a world to LAN
Join the LAN server using another account
Close the LAN world
The player that joined the LAN server will be kicked with the error message
Confirmed for 1.13.1.