Wall mode dynamics and transition to chaos in magnetoconvection with a vertical magnetic field