It could be that, given Flynn's status as a successful thief in Tangled, Rapunzel might have been confident that Flynn would be able to pick the lock, and Gothel might have assumed that it would have still taken him long enough that he couldn't follow them. It was 18 years before Flynn happened upon it, so the chances of this happening again were slim.
It wasn't even as if anyone would find him in the tower anytime soon. Ultimately, this would have been a much worse way to die than from the stab wound, but no one seemed to consider this. The problem is, if Flynn couldn't get out of the tower after the events of Tangled, he would slowly starve to death stuck in the tower. Gothel agreed, but she chained Flynn up inside the tower to make sure he couldn't follow her when she escaped with Rapunzel. She promised that she would go with Gothel anywhere she wanted and wouldn't try to escape, so long as Rapunzel was allowed to heal his wounds. After Mother Gothel stabbed Flynn Rider (who was actually named Eugene Fitzherbert), Rapunzel made a deal with her mother to save his life.