Fix FD leak on file save.