Crooked array saving to files

I think the issue is that you are calling MPI.Init() at the start of the script, and not inside the multiply_matrices function, like you did here Help me pls with method error
Hence, multiple processors are trying to write to the same file at the same time.

I think this happens regardless of whether you have called MPI.Init().

Either move MPI.Init() inside the function or Do something like this to only create the matrices once:

MPI.Init()
if rank == 0
   create_random_matrices()
end
MPI.Barrier()