Made sure to close file in part3, added opening a file in part 4