finalizing databse