I am trying to get this algorithm to close all open positions before the closing bell.  I tried this:

for symbol in self.symbolData:
if symbol in slice.Bars and algorithm.Securities[symbol].Invested and TimeRules.BeforeMarketClose[symbol]:
insights.append(Insight(symbol, timedelta(seconds=insight_seconds), InsightType.Price, InsightDirection.Flat))

but that did not work.  Is there something similar to 'BeforeMarketClose' that can be substituted in here within an algorithm framework?  I have read through this thread here as well:  

Thank you!