How to make puch button to close the whole database in LO base?

hello, is it possible to write a macro to close the whole database with a push button? Thanks

You have to get the database document. Its the parent of the form-document.

oDoc = thisComponent.Parent
oDoc.store()
oDoc.close(True)