Basis-set expansion of the Dirac equation without variational collapse: Numerical test of the forth-back free-particle Foldy-Wouthuysen transformation