[PATCH 379/415] file: add take_fd() cleanup helper