fix #open for "w"

@yilongli please review