Made Owin dispose hook more defensive, fixes #1295