Cannot delete asset with AssetDatabase.DeleteAsset?

when I try to delete .asset I get this error:

Failed to remove asset meta data because some of its object’s were still loaded!

here’s the code:

    public void CopyCurrentStorage(string stPath, string path, string name){
	string toPath = path +"/" +name +".asset";
	if(System.IO.File.Exists(Application.dataPath +"/" +toPath))
		Debug.Log(AssetDatabase.DeleteAsset(toPath));
		//if(AssetDatabase.DeleteAsset(toPath))
		//	AssetDatabase.CopyAsset(stPath, toPath);
	else AssetDatabase.CopyAsset(stPath, toPath);
	
	AssetDatabase.Refresh();
}

How could I ‘unload objects’ from .meta?
(Deleting from editor with pressing works fine)

Works without System.IO.File.Exists