That can happen when you stop pressing W but the game still thinks you are, and it keeps you moving. It can also be caused by sticky keys (not the annoying windows sticky keys, real life sticky keys).
Try holding it down for a fraction of a second longer, and see if that helps. If not, then...