Once you get the document object, then use the Close method of said document with correct argument for the Save argument of the method. Since you know the name, then you can get the document object from the Document Collection. If it is found, then close it.
Its early for me, so something along the lines of ( code written here, and no testing ):
(defun CloseAndSave ( dwgName bSave )
(vlax-for i (vla-get-Documents (vlax-get-Acad-Object))
(if (= (strcase dwgName) (strcase (vla-get-Name i)))
(if
(and
bSave
(equal (vla-get-ReadOnly i) :vlax-false)
)
(vla-Close i :vlax-true)
(vla-Close i :vlax-false)
)
)
)
)