Fix memory leak in WKB writer