Added ending database session when exiting.