Made EntityManager flush operation Entity specific

I encountered weird behavior where Entities were flushed to the database when I never intended to. It appeared I indicated the session to write and close at the end of PHP execution cycle. Because the EntityManager in the Doctrine Session SaveHandler, performs a general flush, all Entities are flushed, not only the Session Entity.