File writing is now done in a serial queue