The CM class number one problem for curves of genus 2