Properly stop sketches when replacing them.