Strange behaviour when a script is finished

For every script that is finished I got this error

Exception AttributeError: AttributeError("'NoneType' object has no attribute 'raise_exception_on_not_ok_status'",) in <bound method Session.__del__ of <tensorflow.python.client.session.Session object at 0x7f22fdb730d0>> ignored

Some links to track the problem

The proposed way to reproduce the problem (issue #3388) only reproduces the issue with tensorflow < 0.9

import tensorflow as tf

a = tf.constant(123)
b = tf.constant(456)
c = a * b

session = tf.Session()

# A slightly different error is produced if this is removed.
session.run(tf.initialize_all_variables())

result = session.run(c)

print(result)

session.close()    # The error is produced regardless of this.

#quit()            # This produces the error.

import sys
sys.exit()         # This also produces the error.

The issue is still open in the tensorflow bug tracker. Let's track it..