Include window ref in callback so window.close() can be called