Timing the Match: A Deep Reinforcement Learning Approach for Ride-Hailing and Ride-Pooling Services