Optimal Real-Time Traffic Control in Metro Stations