Fix deadlock when restore stream is not used. Fix #19

the callback of stream.write() is invoked only when the object is actually flushed by the underlying stream, this means that if the restoreStream is never used the data will never be flushed causing a deadlock. `write()` will buffer the stream, so there is no point in waiting for the flush anyway.

Fixes #19