close_material_modal function

Close a material modal programmatically.