Sad senior shelter dog gets adopted moments before he was set to be euthanized