Malaysia and Indonesia signed agreements Thursday that ended longstanding maritime border disputes and vowed to bolster cooperation to fight “highly detrimental discriminatory” measures against palm oil.