Drawing plot closed inside mashine loop