I suggest to you, create a simple txt file, for example "test.txt" with inside for example: "abcd", and test your AFileCopy function alone with this test file.
I suggest use the FileExists function too, because is the file doesn't exists, you get "unable to open file" message too...
edit1:You can copy opened file with it:
fmOpenRead or fmShareDenyNone
But much better if the opened file closed and saved...
edit2:I use the TSqlite3Dataset component, but I guess you need this too:
SQLTransaction1.Active:= false;
SQLite3Connection1.Close;