From Restless to Contextual: A Thresholding Bandit Approach to Improve Finite-horizon Performance