game of life: add event listener

Adding the event listener enables the user to close the window directly
through the close button. It also keeps the program from not responding
(which can be annoying, depending on the graphical interface).