Add option for writing output on each EM iteration