On non-windows systems, /var/tmp is used as a hard-coded path for the default state file. Use Dir.tmpdir instead. The path can still be overridden using #UUID::state_file=
When manually setting the state file, set the mode too. Failure to do so causes an implicit conversion of nil to integer on first usage. Also provided a mode method to set the mode explicitly.