Add writer.close for integration tests