Cleaned up the sig handler code on non-windows platforms.
Implemented Windows signal handlers.
NOTE: This needs some clean up.