P8055 digital outputs control under Linux and C

Hello,
I’m working with a P8055-1 board under Linux (C langage) and I want to drive the digital outputs.
When I write:

int adresse = -1;
adresse = OpenDevice(0);
WriteAllDigital(1);
sleep(1);
WriteAllDigital(2);
sleep(1);
ClearAllDigital();
CloseDevice();

output 1 is always ON, output 2 is rarely ON and they are never cleared.
If I write:

int adresse = -1;
adresse = OpenDevice(0);
WriteAllDigital(1);
sleep(1);
CloseDevice();
adresse = openDevice(0);
WriteAllDigital(2);
sleep(1);
CloseDevice();
adresse = openDevice(0);
ClearAllDigital();
CloseDevice();

It works fine!
Is someone already control the digital outputs without OpenDevice / CloseDevice for each access ?
Thank you.