add automatic tf buffer cleaning on bag loop for python

This logic was already implemented for c++
but not for the python module.