Fixes a rouge closing li under certain conditions

This commit fixes a rouge closing LI when the query is upcoming but
there is no previous post link and no past events.