The lifetime of a variable is automatically tracked after its initialization, using the tf.Variable.initializer operation.
Later, after the usage, the session can be closed and the variable can be destroyed, using the tf.Session.close operation.