Sync STDOUT and STDERR for realtime heroku logging

Without this patch log entries from the worker process aren't displayed until
the worker is shut down.  This patch addresses the problem by setting the
STDERR and STDOUT file handles to synchronous mode as documented at
https://devcenter.heroku.com/articles/logging