barrick gold swings to quarterly loss