Feature/handle close event

- Handle the SESSION_CLOSE event for outbound messages
- Added some tests