nvidia-smi and cuda examples get stuck after finishing execution

I have installed the 387.34 drivers for Ubuntu 16.04.3 LTS and when I execute the “nvidia-smi” command, the terminal shows information about the installed driver, GPU and running processes but it gets stuck and doesn’t finish the process until a few seconds later.

Moreover, the same happens when I execute a CUDA example, the example runs correctly but when all the ouput is shown in the terminal, the process doesn’t finish.

What could be the issue?