Added JVM termination safety to server code
Removed redundant shutdown call