Added session closing. Not closing it preventing the application from terminating.