There is no code to persist data when manager is destroyed. Maybe you have a transaction open that is automatically committed when the connection is destroyed (which can happen when manager is destroyed as the connection interface might get out of scope)?
Also don't forget that you need to set the manager in master dataset.