Add missing f.Close() on file creation.