write() must check closed, or it will NPE here, but in any case it must ...

write must throw an IOException if already closed, and must not NPE (it would here). Fix regression introduced by Bombe's don't-throw-patch.