I think they both usually close at 5pm (-ish).
I know they close - temporarily - during thunderstorms.
It may be that they stay open until 6pm in summer, when daylight is longer. It seems to me WDW kept them open a little later when Pandora was new and all of AK was open later. Or like if you happen to go over a major holiday or other time when the parks are exceptionally crowded.