Fixed namespace name.
If resource is null don't use the close function.
Checks if arguments are resources on constructor and destructor curl close.