changed file write modes

a+ to w
a+ to a
r to __