The park stays open until the posted closing hours and as long as you are in line for an attraction before close, you will get to ride it.
Sometimes the park closes at 10pm and Fantasmic may not happen until 10:30. All the rides will close at 10pm, but as normal, many of the shops will remain open for 30-60 minutes past park closing depending on the crowds. You would still want to be over at Fantasmic by 10pm to secure a seat, unless it is slow but they usually only have the second show when the crowds are larger.