close memory object.