Fixed python3 issue in opening files