Contests with Endogenous Deadlines