Estimation DLL: fix bug with creating MAT files

Similar problem to #446