Added clean exits to server.py

Clean exit support for linux and windows