Does that invalidate the patent?
No. Because the filing date of your patent application (and the priority date of any Convention applications in other countries) is earlier than the date you published your paper, there is no issue.
The only downside to doing this is that the public finds out about your invention earlier than they otherwise would. This may or may not be an issue for you, depending on what you want to happen with your invention (though presumably, since you want to publish your findings in a journal, you want the world to know what you've found). In any case, after 18 months your application would be published anyway, so it's not a massive difference.
In fact, there is quite a significant upside to publishing details of your invention early. As soon as your paper is published, it becomes part of the prior art. Nobody else will be able to patent anything that's disclosed in your paper. In contrast, in the 18 months before your patent application is published, there is a risk that another party will independently try to patent similar subject matter. What happens in that case is much more murky and difficult, and differs by country.