__destruct() now checks if the DB resource is valid before closing