Fixed closing of Python Shell