open file for writing