BZ-1061217 - Per Process Instance and Per Request do not remove ksession from db

(cherry picked from commit 4d48a9bc099ed99bc7f2313be74fbda1fcd68013)