Are there any legal consequences that I could encounter with?
If it's possible, what should I keep a close attention to while I'm doing it?
Generally yes, though there are some exceptions.
If you use a tool (like an IDE, an buildtool, a continuous integration system, a version control) open source licenses put no restrictions on you, as the open source definition makes clear that nobody is discriminated because of the usage. So you can use the tools to create every software you wish, included closed source software.
Compilers can be a different case and libraries and frameworks surely are. Still, you can use it for whatever. But, a compiler often links some runtime library to your code. If you use a library or framework, you directly link code. This has effects, as your work now counts as a derivate. With many permissive licenses (BSD, MIT, Apache) this is still no problem, but copyleft-licenses like GPL would would impose that you release your derivate under the GPL too (except it is never released to public and only privately used).
Real world example: GCC is GPL licensed, but use a runtime library exception, so you can still develop closed source software with GCC. But the exception is needed in this case.
Assuming you are simply using the development environment, and are not using any code samples or libraries, yes.
The only sticky situation could be the compiler, especially if it links your code to a standard library. Check to make sure the compiler is either purely transformative (ie. turns your source code directly into object code), or has an explicit exemption for this (eg. GCC's exemption for libstdc++) permitting the standard library to be linked with closed-source software.
It depends how the IDE is licensed. You will need to read the license.
When you produce software with it, you're not relying on the code of the IDE when you release your software, so the GPL same license condition doesn't apply to your program. However, the IDE license may stipulate that any program you produce must be open source.
Read and check first.