Open file in write mode