fixed a bug where an invalid filedescriptor was closed
fix invalid free, add testcase, SparseMatrix#getFilename