let close_if_open fd = (try (ignore(close fd);) with _ -> ())