Features/fileout hang on shutdown

Fixes an intermittent race condition deadlock during FileOutput shutdown.