Learning Koopman Operators with Control Using Bi-level Optimization