VLM Agents Generate Their Own Memories: Distilling Experience into Embodied Programs of Thought