Changed the database connection to use the with statement.