Release server port when shutting down (e.g. switching to Connector mode)
Fix race condition when starting in Connector mode
When starting in Connector mode (i.e. Standalone is open), Zotero first starts in Full mode, looks for Standalone, then "shuts down" and restarts in Connector mode. `Zotero.shutdown()` returns a promise which is then followed up by a `Zotero.init` call. Thus, when starting in Connector mode, Zotero initialization is asynchronous and makes it possible for `Zotero_Browser.init()` to be called before `Zotero.initialized` is true, which prevents `Zotero_Browser` from initializing. Additionally, even if `Zotero_Browser.init()` is called after Zotero is initialized in Connector mode, it is possible that `Zotero_Browser.init()` will be called _after_ the "load" event for browser.xul has already fired, so `chromeLoad` is never called. This patch ensures that both of these race conditions are taken into account.
Merge pull request #495 from aurimasv/Fx-connector

Fix race condition when starting in Connector mode