Updated the Database class to be a singleton and handle opening and closing the connection