Add ensure clause to Writer.new (for when a block is given), so close is always called even if an exception occurs. Does not affect the use of Writer.new when no block is given.
Remove pointless test.