The most reliable way to do this is to completely ignore the time component. Because many stocks that have very low volume in extended hours trade and will not have a candle for 8:00 pm. So if we wrote the code to work strictly with the time of 8:00 pm we would find our code failing for the vast majority of stocks.
Fortunately, you are looking for the close of the last bar of the after-hours session. So we only need to check for "newDay". Then grab the close of the previous bar and hold that until the next "newDay".
Here is the code. Screenshot below shows the result.
def newDay = GetDay() <> GetDay()[1];
rec afterHoursClose = if newDay then close[1] else afterHoursClose[1];
plot data = afterHoursClose;