Getting in right before closing and being able to ride typically happens. The only times that parks might change it is if they anticipate a huge line at closing, similar to how WDW cuts off the Anna & Elsa line at 5 or 6PM, even if they have a 4 hour wait, they'll be done by the time the park closes or shortly after. It would be a logistical nightmare to keep Gringott's open with a 3 hour wait at park closing, because they'd have to have employees in the park to keep people out of trouble as they left (trying to go into closed stores, opening random doors, etc). Gringott's is all the way at the back of the park, it's not like a ride that's right at the front like Terminator or Despicable Me.
Best thing to do ... ask early in the day. A lot of times if they are going to close the line early there will be a sign that says "this line closes at XX:XX PM today" in front of the ride. You don't want to rely on the "slip in one minute before closing" only to find out the line was cut off 2 hours before that.