flushstate to disk Ubuntu

I was reindexing blockchain and I got this message:

Unable to open file /home/ki/.bitcoin/rev00502.dat
ERROR: Flush: fail to open file 502
*** Flushing undo file to disk failed. This is likely the result of an I/ error

Any ideas how to solve it?