Hi,
I would use a variable from a common parent scope to store it.
Reset it before the training and each closure function modify this variable by adding to it. For example by making total_loss a global variable if you use python 2.7 or nonlocal in python 3.5+.