std.File.flush and error causes segfault after calling close

Bugzilla: https://d.puremagic.com/issues/show_bug.cgi?id=12349

I also mark them as `@trusted`.