fix open_[w]memstream behavior when no writes take place