close entity manager properly in resource servlet