Make sure entity managers are closed