Close entity manager once data is retrieved. Fixes #41