Try checking whether your Windows system is closing processes when RAM usage gets high
this can cause the emulator to disconnect unexpectedly. Also, try using a different physical device or emulator image; ADB is known to glitch frequently, and switching devices can often resolve this
Happy code :)