In RAND_write_file, truncate the file to the no. of bytes written