Fixed addFile() to commit the transaction.