IllegalStateException should be thrown for some methods when called on a closed EntityManager
IllegalStateException is not thrown when EntityManager#getMetamodel, #getCriteriaBuilder, #getEntityManagerFactory, or #createNamedQuery is called on closed EntityManager per JPA spec.
Or was this something you wanted me to do?
Be sure to use the corresponding compliance setting: hibernate.jpa.compliance.closed. The "infrastructure" is already in place, you can just check: