At first glance, replace the "goto inicio" at the end of the program with "return" (it was called under a "gosub").