finish a file