Fix junit test and improve jetty shutdown