Did you add enough swap space? this can cause the RPI to crash.
To add a 1gb swap file, in /swapfile:
sudo dd if=/dev/zero of=/swapfile bs=1024M count=1000
sudo mkswap /swapfile
sudo swapon /swapfile
Good catch! I will create it. I also read about enabling zram, to compress ram, but my linux version (Libre Elec) has no support for that.