Error in (CUDA by Example)

When I am running the code given in the Chapter-05 of “CUDA by Example”. I am getting these run time errors…

freeglut ERROR: Internal error in function fgOpenWindow
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 4 (X_DestroyWindow)
Resource id in failed request: 0x0
Serial number of failed request: 19
Current serial number in output stream: 22

Since I am a beginner in CUDA I am not able to rectify the errors. Please help me…