Removed implicit flush from close func. Added some comments