Multiple improvements for tool makeiplist.rb

Hi @mubix,

This PR is for your script makeiplist.rb. I made these two changes:

* Uses optparse to parse arguments. This also allows the script to be a little bit more user-friendly (so that they're less likely to feel the need to read the code before knowing how to use the script.)
* It will make sure file handles are always closed when done. Just for good practice.

If you like this PR, please feel free to merge. If not, please feel free to close, though I highly recommend to make your input/output file paths configurable.