delete connections when we delete a node

Segmentation fault at the end of program when a connected node had been deleted.