added exit on close