Bug: close writer