all: replace any sleep() with nanosleep()

Nanosleep is awesome. Will return instantly upon a signal. Now all problems relating to segfaults upon exit are solved. Beauty.