created custom send function to shut down monitoring threads when socket no longer exists