Are you sure the IDE itself has disconnected? It could be it's still hanging on to the connection?
After you run the flash code, could you try resetting the puck? So just lift the edge of the battery a bit and when you release it the red LED should flash.
Since you're basically deleting all the saved data, it's possible that the Puck's software gets confused when you then try and pair straight away.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Are you sure the IDE itself has disconnected? It could be it's still hanging on to the connection?
After you run the flash code, could you try resetting the puck? So just lift the edge of the battery a bit and when you release it the red LED should flash.
Since you're basically deleting all the saved data, it's possible that the Puck's software gets confused when you then try and pair straight away.