Close the database on end.