Carry over features to threaded architecture

This commit carries over some of the features from the previous
non-threaded version of probot over to the threaded architecture as well
as some new ones.
Namely, the feature list includes:
1) ability to quit on command (ported)
2) respond to PING messages send from server (new bugfix)
   * The old way this worked was by forcibly sending a PING message to
   * the server every so often. This was a naive fix I created whenever
   * I did not understand sockets.
3) correctly close sockets (new to threading)
4) correctly close pipes (new to threading)
5) second thread now waits for input from main thread before carrying
on
   * This makes CPU usage *plummet* \\
   * This is OK, because background backups and saves will now be
   * implemented with timers \\
   * Second thread will schedule (with timers) backup events and process
   * packets
6) multiple messages received in one socket.read() operation will be
split into separate packets and processed individually (new bugfix)

In addition to the numbered feature additions, many hidden bugs were
squashed that were not apparent in the old version of probot, and small
improvements in code structure have been made as well.

This is a very exciting commit. The bare essential groundwork for
threading has been laid out, and now it is time to port the commands
over. The command porting should be a breeze because of the way the
threading commands are set up.
minor change