Fixed deleteFile to properly use transactions