Added method to close the file descriptor.