Closed-loop control of direct ink writing via reinforcement learning