Update database.py

Swap SQLAlchemy's NullPool to QueuePool to resolve threading errors.