Dynamic Planning for LLM-based Graphical User Interface Automation