RubyMine's terminal doesn't always terminate running processes when you close the whole RubyMine window. The most annoying case is when it leaves a dev server running that blocks port 3000. You can terminate such a dev server with this command:
lsof -t -i :3000 -s TCP:LISTEN | xargs kill -9
It might be worth it to add this to your bash aliases.