Fixed signal handler bug. Ctrl-C writes correct object to file now.