Brooklyn ends 2017 as safest year on record