Smooth out shutdown behavior

Ignore return value of send when transmitting a $X termination message;

Shut down cleanly when we receive a closed message to avoid race
conditions that lead to spurious error reports;