Fix a variety of problems
- Close messages when done, stop leaking resources
- Correct a Socket Option call when opening a socket