A few years ago, I found myself at the Barneys department store in Beverly Hills on Dec. 24, wandering around on the men’s floor. It was almost closing time, and there was something depressing about being at Barneys at dusk on the night before Christmas. The store was empty, almost ghost-like, except for another shopper, who looked like he could be related to Leonardo DiCaprio, scanning a rack of winter jackets. As I reached for the price tag of a shirt, my arm bushed against the stranger’s.

“Oops,” I apologized. The DiCaprio clone didn’t respond or look up, but he exhaled a puff of smoke from a vape pen.

Oh my god! This was the real DiCaprio.

Suddenly, my random shopping excursion didn’t seem so dull. Why was DiCaprio at Barneys on Christmas Eve? It looked like he was preparing for some winter snow trip, and instead of sending an assistant or stylist to pick up an assortment of warm clothes — as most A-list celebrities would do — he wanted to scope out the merchandise for himself. In the fitting room (obviously I followed Leo into the fitting room), I eavesdropped as a sales clerk scurried in and out with more sizes. By the time I left the store, DiCaprio was at the register, ringing up piles and piles of clothes, enough to fill the entirety of Jay Gatsby’s closet.

For the last two decades, Barneys has been my favorite department store: over-the-top and eccentric, towering with luxury goods, but not in a gauche way. The fact that it’s closing forever this weekend, after declaring bankruptcy last fall, is the end of an era, the sign of online retailers gobbling up a famous brick-and-mortar institution and a tragic heartbreak for anyone who loved to shop. As a magazine editor living in New York City in the 2000s, I probably shouldn’t have been spending so much money at Barneys, but I couldn’t help it.

To enter the Barneys flagship store on Madison Avenue was to be transported to a different time, when New York was the retail capital of the world, where being in a department store carried a fancy aura, similar to flying in the front of the airplane or having lunch at a really nice restaurant. (A trip to Barneys certainly wasn’t like Bloomingdale’s, Nordstrom or Saks Fifth Avenue, which also sell designer clothing, but in a setting that feels like a visit to a suburban mall.)

I wasn’t around when Barneys first launched in 1923, in a 500-square-foot space with menswear, but the mythology of the store reached me through Hollywood. The ladies of “Sex and the City” frequently stopped there to lounge and browse for their Manolo Blahniks. In an interview with Vanity Fair, Sarah Jessica Parker captured the essence of Barneys in the 2000s, before the economy crashed. “If you’re a nice person and you work hard, you get to go to Barneys,” she said. “It’s the decadent reward.”

Indeed, it was hard not run into a famous person at Barneys. I once saw George Lucas eating lunch in New York, and Arnold Schwarzenegger dining in the Los Angeles location. Online, there are vintage paparazzi photos of everyone from Joe Biden to Britney Spears to Nicole Kidman on Barneys runs. More recently, I spotted Billy Porter in the downtown Chelsea store. Tim Gunn told me how he’d avoid the famous Barney’s warehouse sale, which used to be held annually in Chelsea, where even Wall Street bros made the pilgrimage to stock up on suits and dress shoes. But online shopping changed that, and for the last 10 years, there was a standalone Barneys warehouse website for last-chance clearance deals.

The other way that Barneys was different from other department stores was in the editing (an important trait, as any writer will tell you). The store had the sharp point of view by getting onboard with brands that were hipper and more stylish than its competitors. And while splurging at Barneys was akin to a suicide mission, the twice-a-year Barneys department store sales, with up to 60% markdowns, meant that you could add many fantastic pieces to your wardrobe without going completely broke.

It was because of Barneys that I’d discovered that the best way to travel in New York is in a pair of Prada boots or Lanvin sneakers. It introduced me to under-the-radar men’s designers (at the time) such as Rogues Gallery (RIP!), Rag & Bone, Nice Collective, Acme and ATM. Barneys gave me the red tuxedo jacket from Ermenegildo Zegna that I wore at the Cannes Film Festival. And it was my favorite place to buy gifts. My parents have a Lady Gaga snow globe in their home, from a collection that she designed for the store in Christmas 2011.

You could say that Barneys died because the store’s owners expanded too quickly to too many different cities. Did they really need to be in Boston or Chicago? Another thing that killed the store was the way in which people buy everything, even luxury clothes, online — not at retail prices. If Barneys is gone, it’s hard not to imagine other big stores crumbling soon enough.

After Authentic Brands Group bought Barneys in November, they decided to shutter all the stores, which led to a massive (but annoying) liquidation sale. The final gasp of Barneys came in small reductions at first — 10% to 25% — as the stores were slowly stripped away of everything that made them special. In the Manhattan location on Madison Avenue, the escalators no longer worked. The dressing rooms were covered in signs, warning people not to take too many items inside, a la Filene’s Basement. When I bought a necklace, the sales associate told me he had no boxes or bags, and he didn’t see the point of printing out a receipt because everything was final sale.

At the Beverly Hills store, I took home a set of Christmas ornaments that were 70% off. As the clerk rang me up, she complained that the store’s system had been hacked, and nobody had been paid in a few days. My favorite discovery, though, was a Mariah Carey T-shirt that I scooped up in San Francisco, from a brand that I’d never heard of. Why do I need a Mariah Carey T-shirt from Barneys? Why not!?

Then, last weekend, I visited the Barneys on Madison Avenue for the final time. As I walked inside, there were signs that read “Last 8 Days!” and “Everything Must Go.” The elevators had stopped operating on all the floors because most of them had been cleared out. Instead of coats and jeans and shoes, there were big bags of trash in every corner. It was eerie to reach the top floor of Barneys and see it as a naked shell, with bare carpet and broken hangers littered on the ground. But the restaurant, Freds, will remain open for now, with the staff of waiters inside resembling the orchestra on the Titanic, which continued to play even as the ship sank.

I knew how they felt. I’ll never let go, Barneys.