Carlsberg has been fined £3 million after a contractor died and another was seriously injured following an ammonia gas leak at one of its breweries.