Man fights off bear trying to attack his dogs