added in code to open and close a file in preparation for writing
merged work done on both computers