The Blues had a nervy finish but managed to get the job done against Brentford.