added input handler. can now close the window