Added writetodisk method, working close method with mode="a".