Berkshire Hathaway snapped its two-year losing streak against the benchmark S&P 500 stock index, but it was close.