Fix error checking to avoid calling NtQueryObject on bad objects

While doing a code review of my previous changes I spotted an error in the condition checking.

GetLastError was never called before checking the error value.

I was able to successfully cause psutil 2.1.1 (PyPi) on Python 3.4.1 to hang by calling get_open_files().  After this patch, get_open_files() returns the correct results.

This should solve issue #340