fixed the exit issues. one todo left (the actually closing the window part