This is a bad programing.
You use a gosub to main but there is no return from the main.
Delete the line gosub main as there is no point.
Be very careful with such commands, as it is common to novice programmers this error. Your program will crash with no obvious reason.
Ioannis
Bookmarks