Ensure frames can not be interspersed on send

Address #507 by adding a write lock and making message sending append to the output buffer directly instead of frame-by-frame.
Merge pull request #509 from pika/507-frame-writing

Ensure frames can not be interspersed on send