when I pause the program it shows that it is stuck in an infinite loop in the default handler in "startup_stm32wl55jcix.s", any idea what could be causing this?
Any time your app gets stuck in the default_handler, it means that it received an interrupt it wasn't prepared for. When you pause the program in that state, you can find out which interrupt(s) caused it to get there by looking in the register view in STMCubeIDE. Here's some better info on how to do that: How can I determine interrupt source on an stm32?
My best guess is that when you change the timebase to a different timer, either SysTick or that other timer is generating an interrupt, and the stm32*_it.c file doesn't have an interrupt handler defined for it.