changed writeout stuff for main -> now writes an initial file and doesnt add on the unnecessary extra one at the end. Also sends correct rank to BoundaryIN