defer waits if all files are saved