Fix issue of saving closed material file