Mistakes doom 49ers and create tight NFC West race