Changed to close database connections after requests are completed.