All that's closing is the main window. Zotero keeps running normally in
the background — all DB connections, etc., stay open, and the same
should apply to your code, since items can still be saved. When the main
window is reopened, Zotero initializes the Zotero pane again
(zoteroPane.js/overlay.js code), but it's not starting up again
(zotero.js code). This isn't much different from how multiple windows
used to work in Firefox. It sounds like you're just initing on window
code instead of application code.
There's not currently an equivalent on Windows or Linux (though there
might be in the future if we support minimizing to the system tray on
Windows).