Fixed memory leak from unfreed write buffer