Since you don't need to retain the `File` (`fd` in your code) after the write it's cleaner use the block syntax for both writes:

```ruby
File.open(tmov, 'w') do |f|
  f.write(shellcode.encoded)
end
```