open in write mode