Fix a memory corruption in posix.urandom

In addition fix a valgrind uninitialized memory use warning
and close the opened file descriptor in posix.urandom