fixed lines for closing files
added mpi interface and started abstracting statepoint output writing