Instead of keeping the state, keep a handle to the socket and shutdown the socket when you are done.
Instead of keeping the state, keep a handle to the socket and shutdown the socket when you are done.

gubatron/wp_tweeting_bot,gubatron/wp_tweeting_bot