Hello RaKo,
Looks like a race condition to me.
I haven't tried the code you reference but I think you would need some delay between the time you send the exposure request to the camera (you are asking for a 5 second exposure) and when you look for the response.
BobT