You can find some sample code for opening window here
(by setting VisibleOnPageLoad property to True).
window from code
Another option is using the RegisterStartupScript() server method to invoke the client method to open/close windows. More information on invoking the client function will be available in the KB Article.