Window Api's and Connection Cleanup.