The problem you encountered is related to the presence of a DC component in the velocity.
Another way to solve the problem could be to use the detrend()
function (if you are working with MATLAB) in such a way to remove only that component.
If this does not work well enough than you can thing about applying a filter, high-pass should be enough. Unless you need to remove some noise from the signal, you can set di cut-off frequency to a really low value in order to touch only the DC component you want to remove.
A comment related to the integration method you are using. The trapezium rule only suffers from the introduction of low-frequency components and therefore does not require the use of a low-pass filter (this is why I said an high-pass filter should be enough for your signals).
Finally, some references related to time integration of acceleration measurements:
J.G.T. Ribeiro, J.L.F. Freire, J.T.P. de Castro, Some comments on digital integration to measure displacements using accelerometers
J.G.T. Ribeiro, J.L.F. Freire, J.T.P. de Castro, New improvements in the digital double integration filtering method to measure displacements using accelerometers