used "with open" instead ofr the normal open so it closes the file automatically