Use the following setting to prevent Xshell from exiting when the connection is closed.

  1. From the Xshell tool bar, click Tools, and then Options.
    RESULT: Options dialog box opens up.
  2. Click the Advanced tab.
  3. In the Options area, select 'Revert to local shell when connection is closed'.