make the window close when done running
more updates to make the application auto-close when complete