I see some valuable information in the other answers and the comments, but also some misinformation, so I try to give a summary and add some additional things.
Will I have some advantage if I open source the algorithm under copyleft licence (GPL etc.)?
By publishing the source code of an implementation of your algorithm under GPL (I assume that is what you meant), you get the advantage of demonstrating your algorithm works as intended, and everyone can inspect your source code to make sure it does not contain anything "unusual" like severe bugs or malware. Maybe you will get some contributors for further improvements. And since you are the copyright holder, you are still free to publish or sell your implementation to others under a different license.
A different question is if it brings you any advantage to be the first publishing that algorithm. By beeing the first you could try to prevent someone else to get a patent on that algorithm, since your implementation will serve as some kind of proof you are the inventor. But as @Snowman has correctly pointed out in a comment, due to the first-to-file (as opposed to first-to-invent) policy of many european patent regulations, that may actually not work.
From what I know about licensing this should lock people out from using the exactly same code as closed source, but would they be able to "rewrite" the algorithm as closed source?
You lock people from publishing your source code or modifications of it in closed source, not from using it inside a commercial organization. You lock people from publishing it as open or closed source under a different license than GPL. However, you do not lock people from publishing a new "clean-room" implementation of your algorithm under an arbitrary license, which is an implementation made only from your description of the algorithm, without actually looking into the source code.
Since I am from the European Union do I need to look for software patents if I wanted to copyleft it?
Though the laws of many european countries formally forbid patents on pure algorithms, lots of companies have circumvented those laws in the past by declaring specific algorithms as "computer-implemented inventions". AFAIK, European patent offices did not accept as many algorithmic patents as US patent offices in the past, nethertheless they have accepted thousands of patents over the years which can be interpreted as patents on algorithms. If those patents would actually hold in court is a different question, but someone who wants to find out will typically have to the put this on trial, with all related risks. Two of the most popular groups of examples were mentioned in the comments, the patents concerning GIF image compression and the patents concerning MP3 compression / decompression, see here for more examples.
So if you want to reduce the risk of getting sued, before publishing a software containing a specific algorithm, you should probably look if there is someone who is holding a patent on it, even in the EU.