Multilevel-in-Time Methods for Optimal Control of PDEs and Training of Recurrent Neural Networks