Try to close the matrix and transpose before re-writing. Windows is unhappy if you write an open file :(