Finished writing to file functionality