Revert "First pass at locking for syncstream."

This reverts commit 1261936ddb75e91c78a91d830dad3a575d17ffe3. We'll
take a safer, more general, approach.
Add infrastructure for mutex release on exception.
Protect all I/O operations using handle mutex.

This takes it at a much higher level, which should avoid issues with
duplicate takes. Uses exception-release mechanism also, to be far more
robust in the event of an exception.