It's an issue that panelManager.minimizePanel() doesn't work, we'll fix it in next release.
About how to minimize/maximize widget/panel programmatically?
You can have a look at the minimizeWidget() function in widgetManager, it's very simple. It just change the widget's window state and call widget's onMinimize() function. So, it's widget's job to minimize itself in it's onMinimize() function. Panel has the similar design pattern.
For off-panel widget, you should use widgetManager.minimizeWidget(widgetId);
For in-panel widget, you should use panelManager.minimizePanel(panelId);
panelId=widgetId + '_panel', you can also use widget.getPanel() to get widget's panel in next release.