fix bulk_write context manager.