title: python opencv: destroyallwindow does not work
body: <p>I am a beginner in image processing, opencv, and python.
  I want to display an image using jupyter notebook on Mac and close the window but its not working.  In addition, python.app stops working so I have to force quit it, causing my kernel to die, which I then have to restart as well.
  I am using python 2.7 for this and opencv 3.4.1</p>
  
  <pre><code>import numpy as np
  import cv2
  
  # Load an color image in grayscale
  img = cv2.imread('messi5.jpg',0)
  cv2.imshow('image',img)
  cv2.waitKey(0)
  cv2.destroyAllWindows()
  </code></pre>
  
  <p>it is partially not duplicate as it tries to seek answer for jupyter notebook.</p>