Erase memory before programming

Programming fails if the chip isn't erased first - not sure why.