mainWindow.loadUrl seems to be opening the url in the chrome external browser window, not within the electron app, if it's happening on the second load.
maybe there's a way to reload the window if it's already open?