corrected an "open"->"write"->"close" to a "with open"->"write"