Feature/handle close event

- Handle the SESSION_CLOSE event for outbound messages
- Added some tests
Firstly, we shouldn't be touching `message.payload` directly anywhere. (We have a lot of old code that does, but new code shouldn't.) Instead, use `message[<field>]` to get at things in the message.

Secondly, the core fields are all validated when the message object is created, so you can assume that they'll be present. (Most of them are allowed to be `None`, though.)

All you need to do here is `if not message['content']:`, and similarly for the `in_reply_to` check below.