The two functions you mention are not exposed in RhinoCommon. That said, there should be ways to close all docking bars and toolbars.
For example, most of the dock bars are displayed by command, and these commands have scriptable options to show or hide the dock bar.
Also, RhinoCommon can open and close toolbar. See Rhino.UI for ToolbarCollection, ToolbarGroup, Toolbar, etc.