Don't attempt to send data if we're just about to exit.

This causes a spurious "AttributeError: 'NoneType' object has no
attribute 'sendall'" in send_data().