fix double shm move on reattach on 5.3+
cleanup and gracefull exit