Bayern, who led 3-0 at one point in the first half, endured a nervy final few minutes in the German capital