Added proper logout with esc key.