Barney Miller never had an ending episode. The creator just quit because he didn’t want to run out of creative scenarios and dilute it’s history.
Actually, the series ended with a three part episode called "Landmark." The building which housed the 12th precinct was sold to a private developer, and all of the detectives were reassigned to other precincts. Barney was promoted to Inspector.