Here is a very nice article with remedy of the problem with custom sign in form in SharePoint 2010. Invalid argument exception occurs upon sign out or sign in as a different user options. Fix is to move your custom code from _LoggedIn event handler to the _Authenticate event handler as detailed in below post:
http://www.7388.info/index.php/article/wpf/2011-03-03/9144.html
a62c12cf-361b-49af-bfed-9d94a35287e0|1|2.0
SharePoint
SharePoint, Exception, Custom SignIn Form