Added setup.py. Ensured that database connections get closed.