Migrations: Write script to .sql file (Fixes #420)

This is more-or-less the same logic we used in EF6.
Wow, what a pain! Personally, I'm fine letting the `catch` block handle this. The only thing NewFile gives us over OpenFile is that it lets the user decide where to save it.