Fixed File IO Stream ug by flushing and closing all connections.