If ffmpeg crashes:
https://ffmpeg.org/bugreports.html
In general I find your solutions to be overly complicated. ffmpeg can read from mkv, convert the audio and then output mp4 in a single step. It's not necessary to split it into several steps with demuxing, converting, remuxing. Note that eac3to's encoders and decoders are outdated or sometimes non-existant compared to ffmpeg.