My Undergraduate education will be ending soon, and I want to work on an independent project with one of the professor even after my graduation before joining another university for my masters. Is there any possible way this can be made possible, if so, will I be able to publish the particular work in a top academic journal.
You can work with anyone you like who will also work with you, so yes. Whether the paper can be published depends on the journal editor and reviewers, which depends, in turn, on the quality and novelty of the paper.
There are no real barriers to doing research. There are no real barriers (maybe a bit of money is needed) for submitting a paper. In particular, affiliation with an academic institution is not a prerequisite for publishing papers.
Nike said it best. Just Do It.
Additionally, some research experience now will enhance your application later and will keep you mentally engaged. A productive gap is much better than the alternative.