If I, on Remote desktop log in on Windows server, and then closes the window, am I still being treated as logged on?
By default, what you describe creates a disconnected RDS session which still treats you as logged on, so your task should still run.
However, this behavior of Remote Desktop Services (RDS) is easily and commonly configured to behave differently from the default behavior. Most common is setting a disconnection timeout, after which disconnected sessions are logged out, but I've personally been tasked with configuring RDS to log users out on disconnect.
A good way to check on whether or not a disconnected sessions is still logged in is open up the Remote Desktop Services Manager, which you can do remotely from a server or workstation with the RDS role installed, or with the Remote Server Administration Tools (RSAT) installed.
RSAT for Windows 8.1
RSAT for Windows 7 w SP1
You can then connect to a remote computer and view the users, sessions and processes on that computer, as in the example screenclip below.

As you can see, there are a couple of user sessions (ignore the "listener" user, that's not an actual user), one of which is connected ("Active"), but Idle for 1 hour, 55 minutes, and another on that's "Disconnected," and has been for 38 days and change. I should probably do something about that.
And yes, that disconnected user is still logged on, and even running a bunch of processes, even having been disconnected for over a month, which we can see over in the Processes tab.
