Make shutdown_writer() using a suggestion from reddit

We can merge the type assertion and the if onto a single line, so I've
done so. (I'm mostly all for compactness.)