(UPDATE). I executed the same application on another pc (a new windows virtual machine to be precise) and fortunately it returned no errors. Maybe something else was going wrong, because the problem seems not to be code related at this point.