<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def close_fileoutput (self):
 """ Flush and close the file output denoted by self.fd. """

        if self.fd is not None:
            try:
                self.flush()
            except IOError:
                # ignore flush errors
                pass
            if self.close_fd:
                try:
                    self.fd.close()
                except IOError:
                    # ignore close errors
                    pass
            self.fd = None