I was getting the same error when replacing some MyISAM tables. I found that running FLUSH TABLE db.table fixed the issue.