Java Opens And Closes Immediately