You can get in line for a ride up to the very last second before park closing. If the park closes at 9pm, you can get in line at 8:59:59. Even if the queue is 45 minutes they’ll still let you ride. This means that 45 minutes after park closing, guests will still be walking through the parks towards the exits. You won’t be able to do anything during this time and it is likely cast members will be strategically placed to usher you towards the exit. Gift shops at the front of the parks will generally stay open 30-60 minutes after park opening, but at a certain point, cast members will be closing up shop and also encouraging people to leave. Don’t expect to be able hang around any areas other than the front of the park for any extended amount of time after park closing.