I try to hide my main window so that I hasn't to load again later. I got the following code:
function createWindow () {
// Create the browser window.
win = new BrowserWindow({width: 800, height: 600})
// Emitted when the window is closed.
win.on('closed', (event) => {
//win = null
console.log(event);
event.preventDefault();
win.hide();
})
}
So that's not working for me, when I close the window I get this error message:

Can somebody help me? Line 37 is the line with win.hide()
Thank you!