title: Jupyter python kernel dies - OpenAI
body: <p>I am new to reinforcement learning and I am trying to use OpenAI Gym environments.<br>
  First, I installed gym by this command: <code>!pip install gym</code> in jupyter<br>
  And after running again to making sure it is installed completely, I got this output: <br></p>
  
  <pre>
  Requirement already satisfied: gym in c:\program files\anaconda3\lib\site-packages (0.10.5)
  Requirement already satisfied: pyglet>=1.2.0 in c:\program files\anaconda3\lib\site-packages (from gym) (1.3.2)
  Requirement already satisfied: six in c:\program files\anaconda3\lib\site-packages (from gym) (1.11.0)
  Requirement already satisfied: requests>=2.0 in c:\program files\anaconda3\lib\site-packages (from gym) (2.19.1)
  Requirement already satisfied: numpy>=1.10.4 in c:\program files\anaconda3\lib\site-packages (from gym) (1.13.3)
  Requirement already satisfied: future in c:\program files\anaconda3\lib\site-packages (from pyglet>=1.2.0->gym) (0.16.0)
  Requirement already satisfied: urllib3=1.21.1 in c:\program files\anaconda3\lib\site-packages (from requests>=2.0->gym) (1.23)
  Requirement already satisfied: certifi>=2017.4.17 in c:\program files\anaconda3\lib\site-packages (from requests>=2.0->gym) (2018.4.16)
  Requirement already satisfied: chardet=3.0.2 in c:\program files\anaconda3\lib\site-packages (from requests>=2.0->gym) (3.0.4)
  Requirement already satisfied: idna=2.5 in c:\program files\anaconda3\lib\site-packages (from requests>=2.0->gym) (2.7)
  </pre>
  
  <p><br><br>
  As mentioned on OpenAI Gym Doc page, I tried this code to make sure everything is fine:<br></p>
  
  <pre>
  import gym
  env = gym.make('CartPole-v0')
  for i_episode in range(20):
      observation = env.reset() #The process gets started by calling reset(), which returns an initial observation. 
      for t in range(100):
          env.render()
          print(observation)
          action = env.action_space.sample()
          observation, reward, done, info = env.step(action)
          if done:
              print("Episode finished after {} timesteps".format(t+1))
              break
  
  </pre>
  
  <p><br>
  After running this code, a new window opens and all things are exactly as provided video on doc page.<br>
  <strong>But the problem is when agent done (all episodes ran), kernel dies and restart again.</strong><br><br></p>
  
  <p>I found in some specific versions, <code>gym.make(close=true)</code> could solve the problem. But not in the latest version of anaconda and Gym. the other solution is using this code: <code>env = gym.make('name') env.close()</code>. but the problem is, this <code>close()</code> function, will delete <code>env</code> object so every time we create envrironment.</p>
  
  <p>Regards</p>