Buses run from RESORT -> PARK up until 15-20 minutes prior to closing time.
Buses run from PARK -> RESORT until the theme park is cleared of day guests. (Same case for Water Park)
In the case of Animal Kingdom, regular service runs until DAK is clear. Rainforest buses run until Rainforest Cafe is clear, but no later than 8:45pm.