On Leray's problem for almost periodic flows