fixed bug in hdf5 layer when all data is loaded into memory at once
term criterion in background desructor