Unfortunately, the shake-to-undo gesture and three-finger tap only work within the Notes app. If you accidentally closed the app or performed an action in a different app, the undo option may not be available.