Better assertion for closed cursors and actually use bulkinsert