Vivek, Vinay | Fix memory leaks in tomcat. Read on.

1. Close sessionFactory and all c3p0 connections on app close.
2. Call scheduler shutdown whether it is started or not.